I have a simple redirect in my jQuery script. You click a link, it performs an asynchronous save, then sends the user to the next page via window.location.href. This works fine in all browsers except I have an issue in IE (surprise surprise). On one page in IE, I get the following error when trying to run the script
E.location.protocol is null or not an object
What is odd, is that the script works on other pages. the only thing I can see different is that the page it breaks on contains a google map, whereas the others do not.
Also, this seems to be a problem only in later versions of jQuery (1.4+) but I have to use that for other functionality.
Any suggestions? Thank you.
The save, redirect script ( which gets its location from the 'goto' attribute in an anchor tag in the page):
$("#save_and_go_button").click(function(){
showAction('Saving...');
$.ajax({
type: "POST",
url: "/admin_and_tools/async/save.php",
data: $("#main_form").serialize(),
dataType: "html",
success: function(results){
if(results == 'success'){
hideAction();
//alert('The record has been saved.');
document.location.href = $("#save_and_go_button").attr('goto');
}else{
alert('failed' + results);
}
}
});
});
EDIT: Here is the line it does on in the jQuery code:
if(E.location.protocol!=="file:")
try{return new E.XMLHttpRequest}catch(a){}try{
return new E.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};