I want to call a webservice from jquery. If there any idea?
You can make an AJAX request like any other requests:
$.ajax( {
type:'Get',
url:'http://mysite.com/mywebservice',
success:function(data) {
alert(data);
}
})
Somewhat related to http://stackoverflow.com/questions/230401/how-to-use-jquery-to-call-an-asp-net-web-service/230605
The regular jQuery Ajax requests will not work cross-site, so if you want to query a remote RESTful web service, you'll probably have to make a proxy on your server and query that with a jQuery get request. See this site for an example.
If it's a SOAP web service, you may want to try the jqSOAPClient plugin.
I blogged about how to consume a WCF service using jQuery:
http://yoavniran.wordpress.com/2009/08/02/creating-a-webservice-proxy-with-jquery/
The post shows how to create a service proxy straight up in javascript.
Incase people have a problem like myself following Marwan Aouida's answer ... the code has a small typo. Instead of "success" it says "sucess" change the spelling and the code works fine.