0

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?

feeela
  • 29,399
  • 7
  • 59
  • 71
SFY
  • 61
  • 7

1 Answers1

0

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