Go Back   CodingForums.com > :: Server side development > ASP.NET

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-29-2012, 04:04 AM   PM User | #1
iacemomo
New to the CF scene

 
Join Date: May 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
iacemomo is an unknown quantity at this point
JQuery Ajax call not working in IE...

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!
iacemomo is offline   Reply With Quote
Old 05-29-2012, 06:15 AM   PM User | #2
sreejithpm
New Coder

 
Join Date: Feb 2008
Location: @ God's Own Country
Posts: 57
Thanks: 3
Thanked 5 Times in 5 Posts
sreejithpm is an unknown quantity at this point
Quote:
Originally Posted by iacemomo View Post
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:
Code:
$.ajax({
  type: "GET",
  url: "http://" + webServiceLoc + "Roster/Hello",
  dataType: "json",
  success: function(data) {
         alert(data);
  }
});
__________________
---
By
Sreejith.P.M

Last edited by sreejithpm; 05-29-2012 at 06:24 AM..
sreejithpm is offline   Reply With Quote
Old 05-29-2012, 06:54 PM   PM User | #3
alykins
Senior Coder

 
alykins's Avatar
 
Join Date: Apr 2011
Posts: 1,608
Thanks: 37
Thanked 183 Times in 182 Posts
alykins will become famous soon enough
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?)
__________________

I code C hash-tag .Net
Reference: W3C W3CWiki .Net Lib
Validate: html CSS
Debug: Chrome FireFox IE
alykins is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:02 AM.


Advertisement
Log in to turn off these ads.