Call web method using jquery asp.net

Call web method using jquery asp.net ajax:

function SearchInterventionQuestions() {
$("#divSearchInterventionQuestions").html('');
//debugger;
//var welcomePageURL = document.getElementById("hdnCreateSurveyQuestionsURL");
var createInterventionQuestionsURL = "../Modules/WebForms/InterventionExercise/CreateHappinessExercise.aspx";
var searchText = $("#txtSearchInterventionQuestion")[0].value;
$.ajax({
type: "POST",
url: createInterventionQuestionsURL + "/SearchInterventionQuestion",
data: '{question: "' + searchText + '" }',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSearchInterventionQuestionsSuccess,
failure: function (response) {
alert(response);
}
});
return false;
}

function OnSearchInterventionQuestionsSuccess(response) {
$("#divSearchInterventionQuestions").html(response.d);
return false;
}

No comments:

Post a Comment

Keep ur coding aside.. Relax for some time..