开发者

Firebug not showing the response from jquery form plugin post submit

开发者 https://www.devze.com 2023-03-17 19:29 出处:网络
I am usinh jquery form plugin with this code $(\".form1\").live(\'submit\', function(e){ $(\".form1\").ajaxSubmit(options);

I am usinh jquery form plugin with this code

$(".form1").live('submit', function(e){   

 $(".form1").ajaxSubmit(options); 
});

Now i see that firebug console shows all ajax requests so that i can see the request and response.

But i have seen that when i use the above code then my ajax request is complete开发者_JAVA技巧d but i can't see any post request in console.

But if i use

$(".form1").live('submit', function(e){   

 var queryString = $('.form1').formSerialize(); 
  $.post('/book/create/', queryString); 

Then i can see the request response

i want to know why is that


Only ajax requests (XMLHttpRequest) are shown in the console. Use the net panel to debug all other requests.

But .ajaxSubmit() is indeed an ajax request as the docs say

ajaxSubmit

Immediately submits the form via AJAX. In the most common use case this is invoked in response to the user clicking a submit button on the form. ajaxSubmit takes zero or one argument. The single argument can be either a callback function or an Options Object.

The problem may be that you're not preventing the actual form submission in your code .

$(".form1").live('submit', function(e){   
   $(".form1").ajaxSubmit(options); 
   return false; // this will prevent the actual form submission.
});
0

精彩评论

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