some code fixed in reference to the following issue: http://stackoverflow.com/questions/7210507/ajax-post-error-refused-to-set-unsafe-header-connection