jQuery .ajax method executing but not firing error (or success)

Posted by John Swaringen on Stack Overflow See other posts from Stack Overflow or by John Swaringen
Published on 2012-09-12T21:32:08Z Indexed on 2012/09/12 21:38 UTC
Read the original article Hit count: 154

Filed under:
|
|
|

I'm having a very strange situation. I have a .NET Web Service (.asmx) that I'm trying to call via jQuery ajax to populate some <select></select>'s. The service is running System.Web.Services like it's supposed to and should be returning a JSON list. At least that's the way I understand that it will in .NET 3.5/4.0.

The main problem is that the .ajax() function (below) seems to execute but the internal callbacks aren't executing. I know it's executing because I can do something before and after the function and both execute, so JavaScript isn't blowing up.

    $.ajax({
    type: "POST",
    contentType: "application/json; charset=utf-8",
    url: 'http://localhost:59191/AFEDropDownService/Service.asmx/GetAVP',
    data: "{}",
    dataType: "jsonp",
    crossDomain: true,
    success: function(list) {
        console.log(list);
        console.log("success!!");
    },
    error: function(msg) {
        console.log("error: " + msg.text);
    }
});

If you need more of the code let me know. Or if you know a better way as I'm trying to build cascading <select></select's.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about ASP.NET