プロジェクト (オンライン フライト チケット) があり、このプロジェクトでは、フライトの詳細を確認するための Json メソッド (または何でも) が必要です。以下の URL にリクエストを投稿する必要があります。(curl -XPOST -H "Content-Type: application/json" http://testapi.xxx.com/rest/flightSearch/YOUR_CODE_HERE -d @request.json) パラメータを URL に投稿して、利用可能なフライトがあるかどうか答えてください。json形式は以下の通りです。} "fromAirport": "ESB", "toAirport": "IST", "fromDate": "2013-02-01", "adult": 1 }
1 に答える
1
次に例を示します。
function PostMyRequest(from, to, date, adult) {
$(document).ready(function () {
$.ajax({
url: 'http://testapi.xxx.com/rest/flightSearch/YOUR_CODE_HERE',
contentType: "application/json; charset=utf-8",
dataType: "json",
data: { 'fromAirport': from, 'toAirport': to, 'fromDate': date, 'adult': adult },
responseType: "json",
success: function(data){
alert( data );
error: OnFail //call some function if you want
});
return false;
})
};
于 2013-02-28T17:00:27.460 に答える