Little late for answering, but this looked like the best place to add my solution to s similar problem you were having.
Had a similar situation, need to use the .ajax POST html response, it contained error messages.
Problem that started with Chrome browser, not allowing async posts after a submit. We had a long running process and needed to show status. So our status tracker was making asycn calls while the submit was occurring, worked in most browser, but recently stopped working in chrome.
-One solution would be to use an iframe and call the other server side code that way. Was not an option for me.
-Or change the server side code to return json and handle the stuff that way, lot more work re-writing client and server code already in place.
I Went down the road of trying to fix the async call problem with Chrome while making a submit post and handle the Html response.
This is what i came up with, and seems to be working.
Went to so many sites and got so many ideas and knowledge, i can t give direct credit to anyone.
So i basically turned the $(form).submit() into an ajax post. But this still has trouble in chrome and other browsers trying to handle the returned html response.
The biggest issue, re-wiring the button events and the javascript.
Hopefully this will help someone.
if (IsChrome()) {
$.ajax({
type: POST ,
url: oo.url,
data: oo.data, // serialized form $(form).serialize(); althought .serializeArray() also seems to work here.
dataType: "html",
cache: false,
async: true,
success: function (result, status, xhr) { HandleChromePostAlreadySubmittedSuccess(result, status, xhr); }, // this being the most important one to handle.
error: function (jqXHR, textStatus, errorThrown) { HandlePostAlreadySubmittedError(jqXHR, textStatus, errorThrown); },
complete: function (jqXHR, textStatus) { HandlePostAlreadySubmittedComplete(jqXHR, textStatus); }
});
} else {
// will POST(even though load is for GETs).
// Chrome does not like the hack way. not sure why, the async status calls stop firing.
// IMPORTANT use .serializeArray() below - will force a POST instead of a GET.
// be careful using the jq LIVE on the submit button, may cause multi events to fire.
// The Complete func below, was not really needed(mines an empty func), unlike the chrome above.
$.load(oo.url, $(form).serializeArray(), function (responseText, textStatus, XMLHttpRequest) { HandlePostAlreadySubmittedComplete(XMLHttpRequest, textStatus); });
}
HandleChromePostAlreadySubmittedSuccess = function (result, status, xhr) {
// Chrome - this is suppose to be the correct way.
// Other browsers decided to program write and close a different way, causing the page to unload, from what i understand.
document.write(result);
document.close();
};