I want to send a parameter to the webservice. The parameter needs to be a variable and not a fixed string.When I write the following code the webservice is called fine and is executed perfectly.
$(document).ready(function() {
$.ajax({
type: "POST",
url: "JsonTestService.asmx/Test",
data:"{'url':'http://www.cramster.com'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
alert(msg.d);
}
});
});
But when I change the line to the following where x is a variable,it doesn't work . Can you tell me how to pass a variable to the webservice in the following code.
data:"{'url':x}",