Can't figure out jQuery ajax call parameters

Posted by chad larson on Stack Overflow See other posts from Stack Overflow or by chad larson
Published on 2010-03-14T00:21:03Z Indexed on 2010/03/14 0:25 UTC
Read the original article Hit count: 593

Filed under:
|
|

I am learning jQuery and trying the following but the parameters are so foreign to me with all the embedded quotes I think that is my problem. Can someone explain the parameters and where quotes go and possibly rewrite my parameters line? (This is a live site to see the required parms).

function AirportInfo() {
var divToBeWorkedOn = '#detail';
var webMethod = "'http://ws.geonames.org/citiesJSON'";
var parameters = "{'north':'44.1','south':'9.9','east':'22.4','west':'55.2','lang':'de'}";
$.ajax({
    type: "POST",
    url: webMethod,
    data: parameters, 
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function(msg) {
        alert(msg.d);
        $(divToBeWorkedOn).html(msg.d);
    },
        error: function(xhr) {
        alert(xhr);
            alert(xhr.statusText);
        alert(xhr.responseText);
            $(divToBeWorkedOn).html("Unavailable");
    }
});
}

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX