Using AJAX call to send custom post data from the form
This was my solution and probably there are the better ones:
It is interesting to note that replacing whole html page via
does not work in IE9.
Summary: if you wanna replace the whole page with newly html-formatted result, you have to use document.open();document.write(NewHTMLDocAsString);document.close(); instead of jQuery('html').html(result);
jQuery.ajax({
url : //URL
type: 'post',
data: {'data' : JSON.stringify(data)},
dataType: 'html',
cache: false,
async : false,
error: function (jqXHR, textStatus, errorThrown) {
document.open();
document.write(res);
document.close();
},
success: function (result) {
document.open();
document.write(result);
document.close();
}
});
It is interesting to note that replacing whole html page via
jQuery('html').html(result);
does not work in IE9.
Summary: if you wanna replace the whole page with newly html-formatted result, you have to use document.open();document.write(NewHTMLDocAsString);document.close(); instead of jQuery('html').html(result);
Comments