誰かがこのjsonをjqueryで受け取るのを手伝ってくれますか?
{
"output_type":"json","diagnostic":{"status":"200","elapsetime":"0.4187","memoryusage":"17.91MB","confirm":"success","lang":"id","currency":"IDR"},"results":{"result":[{"id":"business:3772","label":"Puri Maharani Boutique Hotel & Spa - Denpasar, Denpasar Timur, Kesiman Kertalangu","value":"Puri Maharani Boutique Hotel & Spa","category":"Hotel"},{"id":"business:3852","label":"Maharani Hotel - Jakarta Selatan","value":"Maharani Hotel ","category":"Hotel"},{"id":"business:3874","label":"Maharadja Hotel - Jakarta Selatan, Mampang Prapatan, Tegal Parang","value":"Maharadja Hotel","category":"Hotel"},{"id":"business:4776","label":"Pita Maha Resort and Spa - Gianyar, Ubud, Ubud","value":"Pita Maha Resort and Spa","category":"Hotel"},{"id":"business:4779","label":"The Royal Pita Maha Resort and Spa - Gianyar, Ubud, Kedewatan","value":"The Royal Pita Maha Resort and Spa","category":"Hotel"},{"id":"business:18420","label":"Villa Mahapala Bali - Denpasar, Denpasar Selatan, Sanur","value":"Villa Mahapala Bali","category":"Hotel"},{"id":"business:105246","label":"Mahagiri Dreamland Villas & Spa - Badung, Kuta Selatan, Pecatu","value":"Mahagiri Dreamland Villas & Spa","category":"Hotel"}]},"token":"bc8d3a106572e4cff038261afb568ecf"}
$.getJSON と $.ajax 関数を使用していますが、問題が発生しました。jquery コードを教えてもらえますか?
これは私のコードです、
function getAPI() {
jQuery.ajax({
url: 'http://api.master18.tiket.com/search/autocomplete/hotel?q=mah&token=90d2fad44172390b11527557e6250e50&secretkey=83e2f0484edbd2ad6fc9888c1e30ea44&output=json',
beforeSend: function(x) {
if(x && x.overrideMimeType) {
x.overrideMimeType("application/j-son;charset=UTF-8");
}
},
type:"get",
dataType: 'json',
crossDomain: true,
success: function(data) { console.log(data); }
});
}
しかし、エラーは Uncaught SyntaxError: Unexpected token です: