开发者

Posting Data with JQuery

I'm hoping for a little help - Whatever I try I cannot get jQuery to use the post method. When I look at the request via Charles it is always using the GET method. The code:

   $.post(serviceBaseURL+"get_latest_result_for_location/?jsoncallback=?",{'locationID':locationID}, function(data)
        {

    if(data["status"]=="ok")
    {
        var latestResult = resultToArray(data)[0];
        callback(latestResult);
    }
    else
    {
     开发者_JAVA百科   alert("server connection failed");
    }

        }, "json");

As the server can not get the post data for the request it responds with.

jQuery152027819979432710484_1301989144102({"status":"fail","message":"Please provide a location ID"});

I am using the latest version of JQuery @http://code.jquery.com/jquery-latest.js

Can anyone see where I'm going wrong?

Any help much appreciated.


$.post(serviceBaseURL+"get_latest_result_for_location/?jsoncallback=?",{'locationID':locationID}, function(data)

It looks like you aren't speifying a location id, why is jsoncallback a ? and specify locationid in the same way, so:

'?jsoncallback=?&locationID=' + locationID
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜