jQuery's ajax is causing a full page refresh in FireFox

前端 未结 5 943
Happy的楠姐
Happy的楠姐 2020-12-09 17:29

I\'m making an ajax call with jQuery. The ajax call works fine in IE 7, but FireFox 3 always does a full page refresh when making this call. The ajax call is POSTing to an

5条回答
  •  暖寄归人
    2020-12-09 17:52

    How are you invoking the AJAX method? It could be as simple as canceling the event that initiates the AJAX request if it is also going to cause a submit on the form.

    
    

    Adding the "return false;" will cause the typical submit action to be cancelled. If it is coming from a text box, then you'll want to add e.preventDefault to the handler for the keypress (or whatever) handler that is set up to do the AJAX.

提交回复
热议问题