2016-11-27 82 views
0

jquery ajaxを使用してZomato API呼び出しを作成しようとしていますが、curlコマンドを提供しています。

curl -X GET --header "Accept: application/json" --header "user-key: key" "https://developers.zomato.com/api/v2.1/cities" 

これを$ .ajax()コールに変換する方法は?

答えて

0
$.ajax({ 
    dataType: 'json', 
    url: 'https://developers.zomato.com/api/v2.1/cities', 
    headers: { 
    'user-key': 'put your key in here' 
    } 
    success: function(response, status, xhr) { 
    // Handle the response here. 
    } 
}); 

詳細については、JQuery API docsを参照してください。

関連する問題