i have a form that submits some data and gets html back. this html is used to replace an existing div on the page.
in FF and chrome, it receives the html and renders fine. Problem with this is that in IE, it “ignores” my success function altogether and renders the received html on a new page, which is not the intended function. how do i tell ie not to do this and just follow the success function?
I forgot to mention that this only happens when pressing “Enter” (effectively submitting the form). With firefox and chrome, it still submits the form via ajax, but in ie it submits the form via HTML, which forwards me to that html partial response
$(".toggle-form-submit").parents("form").live("submit", function(){
console.log("WHO");
$.ajax({
dataType: 'js',
type: 'POST',
url: myForm.attr("action"),
data: myForm.serialize(),
success: function(html) {
alert("WTF");
if(myForm.parents("fieldset").find(".replaceable").length) {
updateReplaceableAndClearAndCloseFormWithin(myForm.parents("fieldset"), html);
} else {
longPanelUpdateReplaceableAndClearAndCloseFormWithin(myForm.parents("fieldset"), html);
}
if( $(".test-categories-list").length) {
initSortableTestCases();
}
}
});
});
You are telling it to run the JS when the submit button is being clicked … which it isn’t.
should probably be:
… but make sure that when the JS doesn’t run, the result stills makes sense. You can’t guarantee that the user (or their sysad, or a bad connection, or something else) won’t block the JS.