Window.Location Not Working In IE?
Just for anyone having the same issue, the problem was because the window.location was inside the Ajax post method.
Just replace the window.location with a function() that then calls the window.location or do it after the Ajax call completely.
YodasMyDad
Updated on June 10, 2022Comments
-
YodasMyDad almost 2 years
I have been trying to figure this out all afternoon, but have given up and now turning to you clever people to help :)
I have the following Jquery/Javascript function, which is working fine in Chrome - BUT in IE nothing happens?
$(".btnsubmitpost").click(function () { var topicid = $(this).attr('rel'); var sbody = tinyMCE.get('txtPost').getContent(); $('.topicpostlistnewpost').remove(); $('.postsuccess').show(); $.post("/myurl/" + topicid + ".aspx", { "postcontent": sbody }, function (data) { var returnUrl = $("value", data).text(); window.location.href = returnUrl; return false; }); return false; });
I have tried window.location, window.location.href both with full urls and absolute Urls but IE just doesn't like it? Any ideas?
The function just gets a Url back from a post, and is supposed to redirect the user to the Url. But like I say, works in Chrome fine just not in IE (Tried IE8 and IE9)
-
kk1076 over 10 yearsCalling the window.location.href in success of ajax post makes the same issue ??
-
Nayas Subramanian over 7 yearsReplacing the window.location with a function didn't work for me. Any other alternative, other than placing window.location after ajax call