Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    May 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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!

  • #2
    New Coder
    Join Date
    Feb 2008
    Location
    @ God's Own Country
    Posts
    57
    Thanks
    3
    Thanked 5 Times in 5 Posts
    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);
      }
    });
    Last edited by sreejithpm; 05-29-2012 at 06:24 AM.
    ---
    By
    Sreejith.P.M

  • #3
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,806
    Thanks
    41
    Thanked 199 Times in 198 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •