asp.net - Response.Write against @variable when outputting json -


एएसपी.नेट वेब पेज 2 नमूना api.cshtml फ़ाइल:

यह कोड सही जेएसएस वापस करता है एक jquery $। एएक्सएक्स कॉल द्वारा मान्यता प्राप्त है:

  @ {var डेटा 1 = ऐपफंक्शन .परफ़ॉर्मसेक्ट (ऐपस्टेट ["यू 1select"]। टूस्ट्रिंग ()); Var jsondata = Json.Encode (डेटा 1); Response.ContentType = "आवेदन / जेसन; वर्णसेट = यूटीएफ -8"; Response.Write (jsondata); }   

लेकिन यह नहीं है। क्यों?

  @ {var डेटा 1 = ऐपफंक्शन .परफ़ॉर्मसेक्ट (ऐपस्टेट ["यू 1select"]। टूस्ट्रिंग ()); Var jsondata = Json.Encode (डेटा 1); Response.ContentType = "आवेदन / जेसन; वर्णसेट = यूटीएफ -8"; } @ Jsondata  

मुझे लगता है कि यह एक जेएसएन आउटपुट जारी करने के बजाय रेजर से संबंधित है - response.write (jsondata) के बजाय आपने Html.Raw (jsondata) या Html.Output (jsondata) का उपयोग किया है। ?

Comments

Post a Comment

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -