开发者

jQuery ajax redirect

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜