Reputation: 1296
i am trying to make AJAX Call to ASP.Net Server Side Web service method the problem it dose not give me error or exception
i am trying to execute a peace of code when the user click button i want it ti call my custom service and execute it then return me the result in another control [Grid View ]
the code is :
<script type = "text/javascript">
function myfunction() {
$.ajax({
type: "POST",
url: "My method",
data: Bind Data,
dataType: "json",
success: alert();,
});
}
</script>
the problem is it dose not work i try the fire bug and it do not call the method
Upvotes: 0
Views: 802
Reputation: 31033
$.ajax({
type: "POST",
url: "/path/to/webservice",
data: {data:data}, //not sure what Data Bind is?
dataType: "json",
success:function(data){
alert("success");
},
error:function(jxhr){
alert(jxhr.responseText);
}
});
also here is a useful link POSTing JSON Data to MVC Controllers
Upvotes: 1
Reputation: 1296
well the question is not clear if you did not make some thing like that before you need to be more specific in your problem you are trying to make a AJAX Call to ASP.Net Server Side Web service method using j query I have a similier post to the same problem in my blog have a look :
http://eslamsoliman.blogspot.com/2011/07/make-ajax-call-to-aspnet-server-side.html
i think that the problem in your jquery code in the URL part and in the success part ,mark as answered if it helps :)
Upvotes: 0