I am working on the page in that I have two dropdown control. One control value should be loaded based on the other dropdown control onchange event. I am using the ajax call method to load the second dropdown control.
Using the default call I am unable to trigger the controller action method.
I am using custom routing. I am receiving the 404 error while the ajax call executed.
$(document).on("change", "#dropdown1", function () { var testId = $(this).val(); $.ajax({ type: "GET", //url: 'XXXXXXXPageController/GetXXXXMethod', url: '@Url.Action("GetXXXXMethod", "XXXXXXXPageController")', contentType: "application/json; charset=utf-8", data: { bId:$(this).val()}, dataType: "json", success: function (result) { $("#temp").html(result); }, error: function () { alert("Error."); } });
});
Let me know the proper way to call the ajax method.
Hi,
I am working on the page in that I have two dropdown control. One control value should be loaded based on the other dropdown control onchange event. I am using the ajax call method to load the second dropdown control.
Using the default call I am unable to trigger the controller action method.
I am using custom routing. I am receiving the 404 error while the ajax call executed.
$(document).on("change", "#dropdown1", function () {
var testId = $(this).val();
$.ajax({
type: "GET",
//url: 'XXXXXXXPageController/GetXXXXMethod',
url: '@Url.Action("GetXXXXMethod", "XXXXXXXPageController")',
contentType: "application/json; charset=utf-8",
data: { bId:$(this).val()},
dataType: "json",
success: function (result) {
$("#temp").html(result);
},
error: function () {
alert("Error.");
}
});
});
Let me know the proper way to call the ajax method.
Thanks,
Rajkannu.C