使用此网址:
http://mesto.nu/mesto/index.php?service=Service_Person&operation=getPerson¶ms={%22user_id%22:%687456%22,%20%22user_token%22:%232323227acb58da8c44c05c3bb12124113a0e2f55302fed84ed941b7f78a95111%22,%20%22person_id%22:%098678%22}"
浏览器中的生成此JSON:
"HEJSA{"errorCode":0,"data":{"name":"Niklaas Maverick Ingstrup","sex":"Mand","sex_id":"1","marital_status":"Single","marital_status_id":"2","birth_date_stamp":"672357600","image_url":"http:\/\/83.221.133.106\/pictures\/default\/person\/big1.gif","orig_image_url":"http:\/\/83.221.133.106\/pictures\/default\/person\/orig1.gif","per_favourite_place":"Minibar","checkin_venue_name":"null","friend_status":0,"blocked":false,"lat":null,"long":null,"visible":false,"fields":[{"field_id":"12","field_name":"Beskrivelse","values":[{"value_id":"2829","value_text":"20 \u00e5rig \u00f8konomi studerende ved \nKU. "}]}]}}"
如何在HTML或JavaScript或jQuery中触发此URL?我想在PhoneGap for iOS中使用。
答案 0 :(得分:2)
除非您获得此Web应用程序的某种API密钥授权,或者通过本网站的管理,否则很难以有用的方式捕获JSON。访问控制不允许您的域名。
有关跨域AJAX的更多信息:
http://www.nczonline.net/blog/2010/05/25/cross-domain-ajax-with-cross-origin-resource-sharing/
否则,在jquery中,它就像:
一样简单 var jsonObject = $.getJSON("http://yourlongurl.com");