私のコードでは:
$.ajax({
url: 'http://chapters.zmgc.net',
dataType: 'jsonp',
success: function(d){ // "Type","Name","Link","Contact","Location","Icon"
Tabzilla.zgContacts = d;
var countries = [];
d.rows.forEach(function(row){
if (row[0] == 'Country') countries.push(
{link:row[2], contact:row[3], country: row[4]}
);
});
しかし、エラーが発生します。UncaughtSyntaxError:予期しないトークン:
{
"kind": "fusiontables#sqlresponse",
....
URLを実際のファイルに置き換えてdataTypeを削除すると、すべて期待どおりに機能します。
http://jsonlint.com/でhttp://chapters.zmgc.netの出力を検証しましたが、問題ありません。
http://chapters.zmgc.netから返された応答ヘッダーを見ると、次のようになっています。
Connection:keep-alive
Content-Type:application/json
Date:Thu, 13 Dec 2012 17:02:27 GMT
Transfer-Encoding:chunked
ここにコードがありますhttps://github.com/tomarcafe/Z-Tabzilla/blob/gh-pages/z-tabzilla.js#L282ローカルファイルをリモートデータの読み取りに置き換えたいですか?
私は何が欠けていますか?