Click here to Skip to main content
16,016,168 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
Good Morning,

I wish you a happy new year

Let me please ask a question

In my aspx page I am rendering the data from HTML page and I am getting data in Load event.
I need to pass the data like FirstName,LastName etc like 28 fields I need to pass to RestFul WCF service from aspx.cs .

So please explain the process with a brief example.

Thank You
Posted

    .value is a property not an function
    You want to pass json use data of $.ajax
    
    if response data is not JSON you can use $.parseJSON to convertit to JSON

Complete Code

JavaScript
<script type="text/javascript">

$(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: 'Json',

         data:{
           uname:uname,
           password:password
         },

         success: function(data) {  
             $('#name').val(data.name);  
             $('#email').val(data.email);
         }  
     });  
  });  
}); 

</script>      
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900