Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have the Jquery part for call the web method in c#

<script type="text/javascript">
$(document).ready(function () {
$('#btnLoadUserCtrl').click(function () {
var ControlName = "~/sample.ascx";
alert(ControlName);
$.ajax({
type: "POST",
url: "sample.aspx/Result",
data: "{controlName:'" + ControlName + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
alert(response);
$('#uControl').html(response);
},
failure: function (msg) {
alert("msasdas");
alert(msg);
$('#uControl').html(msg);
}
});
});
});
</script>

In this webMethod that returns the string value , After the excecution of function, it came to the success section of jquery, but returns null value..
Posted

You can try like this:
JavaScript
success: function (response) {
var result = response.d;
//if webmethod returning any list 
for (var i = 0; i < result.length; i++) {
  alert(result[i].Property_Name);
}
//Or 
alert(result );
}
 
Share this answer
 
Comments
Member 8393790 8-Nov-12 1:10am    
thank u for ur reply
in your success function just put response.d instead of response
Like
JavaScript
alert(response.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