Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Cross Domain AJAX Works with IE All Version + Chrome + Firefox
WhatsApp
Balaji Vishwanath
Nov 06
2015
1.6
k
0
1
<script type=
"text/javascript"
>
function isIE()
{
var myNav = navigator.userAgent.toLowerCase();
return
(myNav.indexOf(
'msie'
) != -1) ? parseInt(myNav.split(
'msie'
)[1]) :
false
;
}
jQuery(window).load(function()
{
if
(isIE() <= 9 && window.XDomainRequest)
{
if
(window.XDomainRequest)
{
var xdr =
new
XDomainRequest();
var query =
"URL"
;
if
(xdr)
{
xdr.onload = function()
{
alert(xdr.responseText);
}
xdr.onerror = function()
{
/* error handling here */
}
xdr.open(
'GET'
, query);
xdr.send();
}
}
}
else
{
jQuery.ajax(
{
type:
"GET"
,
crossDomain:
true
,
url:
"URL"
,
dataType:
"json"
,
success: function(data)
{
alert(
"Success"
);
},
error: function(response, textStatus, errorThrown)
{
alert(
'not OK '
+ response.responseText);
alert(
'not OK '
+ textStatus.responseText);
alert(
'not OK '
+ errorThrown);
}
});
}
});
</script>
Ajax
IE 9
Chrome
Firefox
Up Next
Cross Domain AJAX Works with IE All Version + Chrome + Firefox