开发者

jQuery ajax redirect

开发者 https://www.devze.com 2023-01-06 05:57 出处:网络
Guys i have a little problem when i submit my form the page gets redirected to the result, instead of staying on the same page. On the server-side i have a PHP that spits an simple status codes like t

Guys i have a little problem when i submit my form the page gets redirected to the result, instead of staying on the same page. On the server-side i have a PHP that spits an simple status codes like this:

echo '<span>Success/Error</span>';
exit;

and this is my request:

 jQuery.ajax({
  type: "POST",
  url: "ajax.php",
  data: dataString,
  success: function() {
   alert('Tr开发者_JAVA技巧ansmitted, but no result');
  },
  error: function() {
   alert('NOT sended');
  }
 });

the form itself its simple:

echo '<form method="POST" enctype="multipart/form-data">';

And btw can someone help me out why the success/error functions are not called?


You wanted to use this.


Remove the method from the form tag

0

精彩评论

暂无评论...
验证码 换一张
取 消