I am calling a server side method by using jquery ajax post method.But it is not getting called Below is my code..
js
var templateName = $("#txtTemplateName").val().trim(),
htmlHeader = $("#txtHtmlHead").val().trim(),
header = $("#txtHeader").val().trim(),
footer = $("#txtFooter").val().trim()
var templateData = {
templateName: templateName,
htmlHeader: htmlHeader,
header: header,
footer: footer
};
i created the javascript object
$.ajax({
type: "POST",
url: "template_brow.aspx/SaveTemplate",
data: JSON.stringify(templateData),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(result) {
alert(result.d);
$("#divTemplate").find("input[type=text]").val('');
$("#divTemplate").find("textarea").val('');
},
error: function() {
alert("Error while calling the server!");
}
});
and in server side i made a custom class with the above properties
[WebMethod(EnableSession = true)]
public static string SaveTemplate(TemplateVariables oTemplateVariables)
{
----
}
TemplateVariables is the custome class
Can anybody help me on this