Ajax読み込みJSONPデータ時間差表示
by iwbjp
HTML
<p id="a"></p>
<p id="b"></p>
JavaScript
var foo = $.ajax({
type: 'GET',
url: 'http://iwb.jp/s/foo.json',
dataType: 'jsonp',
jsonp: 'jsoncallback',
jsonpCallback: 'hoge'
});
foo.done(function(json){
$("#a").text(json.title);
setTimeout(function(){
$("#b").text(json.title);
}, 1000);
});
foo.fail(function(){
alert("error");
});