Click here to Skip to main content
15,669,133 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi to All,
i called webservice from javascript in aspx page. This service return data. its working fine. Here my problem how to assign that return data to var or any other control using javascript. i didn't use C# code anywhere in this codeing.

I have searched many sites, which sites no one post this answer.

Could any one tell me about this.

Nanda Kishore.Ch
Comments 2-Aug-13 8:44am    
code you have tried would be helpful
nandkishorre 2-Aug-13 8:46am    
function save() {

var deptNo = document.getElementById('<%= _txtDept.ClientID %>').value;
var deptName = document.getElementById('<%= _txtDeptName.ClientID %>').value;
var Loca = document.getElementById('<%= _txtLoc.ClientID %>').value;

AutoComplete.save_rec(deptNo, deptName, Loca);
nandkishorre 2-Aug-13 8:47am    
AutoComplete.save_rec(deptNo, deptName, Loca);

this function return value.
vinay.tatipamula 2-Aug-13 8:50am    
the return object is basically an array object. If you are returning more than one item just loop through and show in a html div, span etc...
nandkishorre 2-Aug-13 8:54am    
i returned int

1 solution

If you use jquery assigning to a control is easy.

or to assign to a variable do
var tempVal = result.d;
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