0

使用此网址:

http://mesto.nu/mesto/index.php?service=Service_Person&operation=getPerson&params={%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?我想在 iOS 的 PhoneGap 中使用。

4

1 回答 1

2

除非您通过某种 API 密钥获得此 Web 应用程序的授权,或者通过此站点的管理人员授权,否则很难以有用的方式捕获 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");

于 2012-05-09T21:55:20.247 回答