JSONPではまった
JSONPを使ってみたら、つまんないところでハマッたのでメモ
JSONを定義してあるFile1は共通で、
HTML内のscriptタグの閉じ方で
File2---動かねぇ
File3---動く
あぁぁ、小一時間・・・
ちくしょうめ
■File1:json.js
jsonFeed( [{"No":1 ,"Qes":"問題1"} ,{"No":2 ,"Qes":"問題2"} ] )
■File2:sample.html
<html> <head> <title>JSONP sample</title> <script language="JavaScript"> <!-- function jsonFeed(json) { window.alert(json.length); } //--> </script> </head> <body> <h1>JSONPTEST<h1> <script type="text/javascript" src="jsonp.js"/ > </body> </html>
■File3:sample.html
<html> <head> <title>JSONP sample</title> <script language="JavaScript"> <!-- function jsonFeed(json) { window.alert(json.length); } //--> </script> </head> <body> <h1>JSONPTEST<h1> <script type="text/javascript" src="jsonp.js"></script> </body> </html>