Hello guys i found the answer.
IE9 and lower verstion of IE does not support httpXMLRequest and to solve this problem
we have to make a call by using XDomainRequest.
The answer is below.
if ($.browser.msie && window.XDomainRequest) {
if (window.XDomainRequest) {
var xdr = new XDomainRequest();
var query = 'MyUrl';
if (xdr) {
xdr.onload = function () {
alert(xdr.responseText);
}
xdr.onerror = function () { }
xdr.open('GET', query);
xdr.send();
}
}
}
else {
$.ajax({
type: "GET",
crossDomain: true,
url: 'MyUrl',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data1) {
alert(data1);
},
error: function (response, textStatus, errorThrown) {
alert('not OK ' + response.responseText);
alert('not OK ' + textStatus.responseText);
alert('not OK ' + errorThrown);
}
});
}
thats it.
One more thing if your data is not showing properly on page then set your
document mode as standard so IE will use its maximum capacity of supports.
other browsers are so intelligent so no need to explain more here.
To set document mode standard just put below line in header part of your page.
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
it will work in IE7, IE8 and IE9, IE10 supports all the things so no need to put this.
you can also find solution here.
http://www.kailashtandel.com/2014/01/call-wcf-restful-service-from-cross.html
Enjoy Scripting...