...

View Full Version : JQuery Ajax call not working in IE...



iacemomo
05-29-2012, 04:04 AM
Hello All -
I'm making an ajax call that works fine in FF and Safari, but IE9 is another situation.
On my test server it works fine with IE9, but not in the production server with IE9.

The jQuery code looks like this:

$.get(
"http://" + webServiceLoc + "Roster/Hello",
"",
function (data) { alert(data); },
"json"
);


My web service is simple:

in the interface:

[OperationContract]
[WebGet(UriTemplate="Hello", ResponseFormat=WebMessageFormat.Json)]
[Description("Return string Hello!!!")]
string SayHello();


and class:

public string SayHello()
{
return "Hello!!!";
}


so I think it has something to do with the mime types, as it is working with one server and not another (and thru Googling similar posts), but I don't know enough about setting them.
Any ideas?

Thanks!

sreejithpm
05-29-2012, 06:15 AM
Hello All -
I'm making an ajax call that works fine in FF and Safari, but IE9 is another situation.
On my test server it works fine with IE9, but not in the production server with IE9.

The jQuery code looks like this:

$.get(
"http://" + webServiceLoc + "Roster/Hello",
"",
function (data) { alert(data); },
"json"
);


My web service is simple:

in the interface:

[OperationContract]
[WebGet(UriTemplate="Hello", ResponseFormat=WebMessageFormat.Json)]
[Description("Return string Hello!!!")]
string SayHello();


and class:

public string SayHello()
{
return "Hello!!!";
}


so I think it has something to do with the mime types, as it is working with one server and not another (and thru Googling similar posts), but I don't know enough about setting them.
Any ideas?

Thanks!

Hi,

Please try following code:


$.ajax({
type: "GET",
url: "http://" + webServiceLoc + "Roster/Hello",
dataType: "json",
success: function(data) {
alert(data);
}
});

alykins
05-29-2012, 06:54 PM
I have had issues with AJAX working on my machine but not on server... It usually is due to a missing .dll file. Don't change your code- if it works ok on your test server/machine but not on PROD the problem is not the code- the problem is missing calls. Check to make sure your .dll is referenced correctly/there (check in your publish settings, does the .dll get blown away or does it stay?)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum