jquery json 传递数据

jquery json 传递数据

 
jquery json 传递数据
XML/HTML Code
  1. <div id="page">  
  2.           
  3.         <div class="content" id="section-main">  
  4.             <div id="hierarchical-demo" class="section">  
  5.                   
  6.                 <h4>JSON</h4>  
  7.                 <form name="json_hierarchal" id="json-hierarchal">  
  8.                     <div style="padding:10px 20px 10px 10px;">  
  9.                         <textarea name="json" rows="12" wrap="virtual" class="textarea code" style="width:100% !important" />{  
  10. personal:{  
  11.     first_name:'Dave',   
  12.     last_name:'Stewart',  
  13.     country:'england'  
  14.     },  
  15. contact:{  
  16.     email:'dave@davestewart',  
  17.     phone:'020 0000 0000',  
  18.     method:'phone'  
  19.     }  
  20. }  
  21.                         </textarea>  
  22.                         <div class="json-sample" id="json-simple-sample"> </div>  
  23.                         <input type="button" class="button" value="确定" style="width:100% !important; margin:10px 0px 0px 5px;" onclick="populateForm('hierarchal')" />  
  24.                         <input type="button" class="button" value="重置" style="width:100% !important; margin:10px 0px 0px 5px;" onclick="resetForms('hierarchal')" />  
  25.                     </div>  
  26.   
  27.                 </form>  
  28.                   
  29.                 <h4>Form controls</h4>  
  30.                 <form name="form_hierarchal" id="form-hierarchal" action="" method="post" target="_blank" style="margin-top:15px">  
  31.                     <fieldset>  
  32.                         <legend>Personal</legend>  
  33.                         <ul class="controls">  
  34.                             <li>  
  35.                                 <label for="first-name">First Name</label>  
  36.                                 <input name="personal[first_name]" id="personal-first-name" type="text" class="text" maxlength="" value=""  />  
  37.                             </li>  
  38.                               
  39.                             <li>  
  40.                                 <label for="last-name">Last Name</label>  
  41.                                 <input name="personal[last_name]" id="personal-last-name" type="text" class="text" maxlength="" value=""  />  
  42.                             </li>  
  43.                               
  44.                             <li>  
  45.                                 <label for="personal[country]">Country</label>  
  46.                                 <select name="personal[country]" id="personal-country" class="select-multiple" >  
  47.                                     <option value="" selected="selected">Select...</option>  
  48.                                     <option value="">- - - - - - - - - - - - - - - - - - - - - - </option>  
  49.                                     <option value="england">England</option>  
  50.                                     <option value="scotland">Scotland</option>  
  51.                                     <option value="wales">Wales</option>  
  52.                                     <option value="ireland">Ireland</option>  
  53.                                 </select>  
  54.                             </li>  
  55.   
  56.                         </ul>  
  57.                     </fieldset>  
  58.                       
  59.                     <fieldset>  
  60.                         <legend>Contact</legend>  
  61.                         <ul class="controls">  
  62.                           
  63.                             <li>  
  64.                                 <label for="email">Email</label>  
  65.                                 <input name="contact[email]" id="email" type="text" class="text" maxlength="" value=""  />  
  66.                             </li>  
  67.   
  68.                             <li>  
  69.                                 <label for="phone">Phone</label>  
  70.                                 <input name="contact[phone]" id="phone" type="text" class="text" maxlength="" value=""  />  
  71.                             </li>  
  72.   
  73.                             <li>  
  74.                                 <label for="method">Prefered</label>  
  75.                                 <fieldset id="method">  
  76.                                     <label><input name="contact[method]" id="" type="radio" class="radio" value="email" /> Email</label>  
  77.                                     <label><input name="contact[method]" id="" type="radio" class="radio" value="phone" /> Phone</label>  
  78.                                 </fieldset>  
  79.                             </li>  
  80.   
  81.                         </ul>  
  82.                     </fieldset>  
  83.                 </form>  
  84.                   
  85.             </div>  
  86.             <hr />  
  87.         </div>  
  88.   
  89.     </div>  


原文地址:http://www.freejs.net/article_biaodan_123.html

相关推荐