I want to get the return value for hid and show div after form submit success
<form id='form1' action='api.php' method='post'><input ></input></form>
<div id='layer1'></div>
I tried: Js
$('#form1').submit(function(e){
e.preventdefault();
$('#layer1').show();
});
It doesn't work. Is there anythings that I should return in the api.php? As I am using php5.2 I cannot using something like formdata to upload image when doing form submit.
Can anyone help?
Instead of using origin form submit, add a listener on event 'submit'(or just as you did, invoke .submit()
, no difference), then prevent default behavior, do it using AJAX. See jQuery API
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.