title: how to pass JSON data to restful web services through ajax and also how to get JSON data?
body: <p>Hi, I am new to JSON .My question is how to pass JSON data to restful web services through ajax?</p>
  
  <p>Please Help me.</p>
  
  <p>I tried by following code but I am not sure about it</p>
  
  <p><strong>MY INDEX PAGE</strong></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
   $(document).ready(function(){  
  
       var uname = document.getElementById("uname").value();
       var password = document.getElementById("pwd").value();
  
  
       $('#ok').click(function(){  
           $.ajax({  
               url:'http://localhost:8090/LoginAuthRWS/rest/orders',  
               type:'post',  
               dataType: 'Jsondemo',
  
  
               success: function(data) {  
                   $('#name').val(data.name);  
                   $('#email').val(data.email);  
  
                   var JSONObject= {
                           "uname":uname,
                           "password":password
                           };
               }  
           });  
       });  
  }); 
  
  &lt;/script&gt;  
  </code></pre>