json例子

来源:互联网 发布:淘宝上疯马皮钱包 编辑:程序博客网 时间:2024/04/26 16:18

前台:    

 function loadStireInfo(crruentArticleId)
    {
       $.ajax({
         type:"post",
         url:"util/getStoreInfo.aspx",
         data:{articleId:crruentArticleId},
         beforeSend:function(){ },
         success:function(data)
         { 
           var storeInfo = (new Function("return " + data))();  

          alert(storeInfo.topicImagePath);

          alert(storeInfo.storeSummary);

          alert( storeInfo.storeNum);
        }
    });
   }

 

后台:

 string resultStr = "{\"storeName\":\"" + storeName + "\",\"storeSummary\":\"" + storeSummary + "\",\"storeNum\":\"" + storeNum + "\",\"topicImagePath\":\"" + topicImagePath + "\"}";

 Response.Write(resultStr);

 Response.Flush();
 Response.End();

原创粉丝点击