I have the web service:
[WebMethod]
public void SendMail(string _name, string _email, string _message)
{
//Create Mail Message Object with content that y
Use jQuery library. It makes ajax calls piece a cake. Then follow these items:
ScriptService attribute on your web service (this attribute means that you can call your service from JavaScript)Send items to your web service method
$('#buttonId').click(function(){
// Validating input
$.ajax({
type: 'POST',
url: '/your-web-service-path.asmx/your-method-name',
data: {}
dataType: 'json',
contentType: 'application/json; charset=utf-8',
success: function(r){},
error: function(e){}
});
});
Just note that you have to make a JSON object out of your parameters and the name of the JSON properties should match the name of the web service parameters. Also note that the return value of the web service would be available to you as r.d object passed to success callback of ajax call.