Facing issue with ajax call page controller URL

Vote:
 

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

#228592
Sep 30, 2020 18:12
Quan Mai - Oct 01, 2020 7:26
This is not Commerce, or even Episerver related. You should post this question on Stackoverflow or other forums to get better and quicker answers
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.