javascript - set form target to iframe will still open in new window -
javascript - set form target to iframe will still open in new window -
i want submit form still remain in same page, specify target, points iframe.
in server, response whole new document, page info server.
problem: when submit form first time, works fine.but in sec time open new window, , new window url http://localhost:8100
. if alter server response info pure string, such "hello", page remain in same page.
<form action="http://localhost:8100" method="post" target="my_iframe"> <label for="username">user name:</label> <input id="username" name="username" placeholder="enter name"> <input type="submit" value="submit"> </form> <iframe name="my_iframe" style="display:none"></iframe>
server data:
var result = '<!doctype html><html><head></head><body><script>window.name="post success"</script></body></html>'; response.write(result);
javascript html iframe
Comments
Post a Comment