0

jquery ajax() を使用して mapquest api を呼び出そうとしていますが、次のエラーが発生し続けます。

Statuscode:400

"Illegal argument from request: Error parsing JSON from Request: A JSONObject text must begin with '{' at character 0 of , see http://www.mapquestapi.com/geocoding/ for details on correctly formatting locations."

これが私が作っているjquery ajax呼び出しです:

$.ajax({
    url: "http://www.mapquestapi.com/geocoding/v1/address?key=<mykey>",
    dataType: 'json',
    type: 'POST',
    contentType:'json',
    data: {json: {location: { "postalCode": "98765"}, options: { thumbMaps: false} } },
    success: function(data) { log( data ) },
    error: function(data) { log( 'error occurred - ' + zipCode + ' - ' + data ) }
});

jsonpもdataTypeとして試しましたが、何も機能しません。

URL アプローチは問題なく機能しますが、返された応答をキャプチャするのはより困難です。

http://www.mapquestapi.com/geocoding/v1/address?key=<mykey>&location=89790

どんな助けでも大歓迎です。

マット

4

2 に答える 2