javascript - Jquery getJson not working with php json_encode -


यहाँ नमूना php json_encode आउटपुट है

  {"user_id": 34543456532, "user_status ": सच है," नाम ":" एबीसी "," प्रोप ":" http: \ / \ / pbs.twimg.com \ / profile_images \ / ..... "}   

मैं एम्बर का उपयोग कर रहा हूं, इसलिए रूट है

  मॉडल: फ़ंक्शन (पैराम्स) {रिटर्न एम्। आरएसवीपी। हाश ({अपोस्टः ट्वीट्स, उस्तात्: [$ .getJSON ("status.php ")]}); }   

यह संभाल करने के लिए HTML / हैंडलबार कोड

  {{# if ustat। [0] .user_status}} कुछ करना {{else} } कुछ और करना {{/ if}}   

हालांकि user_status हमेशा झूठ देता है, जब मैं कुछ डमी मानों का उपयोग कर रहा हूं

  मॉडल: फ़ंक्शन (पैराम्स) {रिटर्न इम। आरएसवीपी। हाश ({अपोस्ट्स: ट्वीट्स, उस्तात्: [{"उपयोगकर्ता_आईडी": 34543456532, "यूज़र_स्टैटस"): सच है, "नाम": "एबीसी", "प्रोपिक" : "http: \ / \ / pbs.twimg.com \ / profile_images \ / ....."}]}); }   

यह ठीक काम करता है, त्रुटि कहाँ है और मैं इसे कैसे ठीक कर सकता हूँ? धन्यवाद

$। GetJSON कॉल से डेटा वापस नहीं करता, यह एक वादा देता है शायद ऐसा कुछ बेहतर काम करेगा:

  $। GetJSON ("status.php")। तब (फ़ंक्शन (स्थितिडेटा) {... मॉडल: फ़ंक्शन (पैराम्स) {वापसी Em.RSVP .hash ({uposts: ट्वीट्स, ustat: [statusData]});} ...});    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -