0
在這裏工作是樣本PHP json_encode輸出的Jquery的getJSON不使用PHP json_encode
{"user_id":34543456532,"user_status":true,"name":"ABC","propic":"http:\/\/pbs.twimg.com\/profile_images\/....."}
我使用燼所以這條路線是
model: function(params) {
return Em.RSVP.hash({
uposts: tweets,
ustat: [$.getJSON("status.php")]
});
}
的HTML /車把代碼來處理,這是
{{#if ustat.[0].user_status}}
do something
{{else}}
do something else
{{/if}}
但是user_status總是返回fa倫敦政治經濟學院,當我使用像
model: function(params) {
return Em.RSVP.hash({
uposts: tweets,
ustat: [{"user_id":34543456532,"user_status":true,"name":"ABC","propic":"http:\/\/pbs.twimg.com\/profile_images\/....."}]
});
}
它工作正常了一些虛值,其中錯誤以及如何解決呢?謝謝
'getJSON'在默認情況下會執行異步(AJAX)請求,這不適合您的情況。你必須做同步請求。這可以通過帶有'async'選項的'$ .ajax'完成 – hindmost 2014-10-08 21:01:30