json传递多个字符串

问题描述:

<input id="SubmitCommentsToInvoice" type="button" value="Comments" onclick="ShowCommentBox()" />  
    <script> 
       function ShowCommentBox() { 
        var obj =   
        { 
        "name":"Jim", 
        "Description":"Keep er lit", 
        "Price":"12.5" 
        }; 

        $("#WhereNameGoes").text(obj.name); 

        $("#dialog").dialog({ modal: true });    } 
     </script> 
<div id="dialog" title="Comments" style="display:none;"> 
     <table class="detailstable FadeOutOnEdit"> 
      <tr> 
       <th>Item</th> 
       <th>Description</th> 
       <th>Owed</th> 
      </tr> 
      <tr> 
       <td id="WhereNameGoes"></td> 
       <td id="Description"></td> 
       <td id="Price"></td> 
      </tr> 
     </table> 
     <br /> 
     </div> 

Tyring使用JSON在我的asp.net项目中传递字符串并在屏幕上显示。 点击评论btn时,只有'jim'出现在div中...为什么描述和价格不是?json传递多个字符串

Thaks

因为你没有告诉它。所有你得到的是:

$("#WhereNameGoes").text(obj.name); 

你需要设置其他两个相同的方式。