Using AJAX call to send custom post data from the form

This was my solution and probably there are the better ones:
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

Popular posts from this blog

Exporting Skype Chat/Skype Contacts to csv file using the shell script and sqlite3 (usually already installed on mac)

trim() not supported by IE7 and IE8

Finally, clear explanation of TinyOS 2.x serial packet structure