此示例工作正常(不带参数):
Twitter 上的 JSONP 示例
<html><head><title>Twitter 2.0</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</head><body>
<div id='tweet-list'></div>
<script type="text/javascript">
$(document).ready(function() {
var url = "http://api.twitter.com/1/statuses/user_timeline/codinghorror.json";
$.getJSON(url + "?callback=?", null, function(tweets) {
for(i in tweets) {
tweet = tweets[i];
$("#tweet-list").append(tweet.text + "<hr />");
}
});
});
</script>
</body></html>
但它不适用于此网址:
var url = "https://thiswaschangedforsecurity/Rest/Authenticate/Login?username=jsm&password=a&ip=1";
粘贴到 url 栏时,此 url 返回 json 数据:
{"SessionID":"44e6f809-3b40-43fc-b425-069e9c52cbda","SourceIP":"1","UserID":313}
但我不能让它与 JSONP 一起工作。对此有任何想法吗?