I'm tying to implement a cascading dropdown on a form. When the user selects a value from one select list, an AJAX call is made to retrieve the data to fill a second dropdown. This is an Umbraco form in a partial view rendered with an @Html.Action and a child [HttpGet] method to populate it. This part is working, but mention it for reference.
In my view, I try to issue an AJAX post request to '/Umbraco/Surface/{surface-controller-name}/{action-method-name}" when the dropdown changes, but I get a 404 Not Found error.
I'm new to Umbraco. Any help would be much appreciated.
In Surface Controller...
public class PricingRequestFormSurfaceController : SurfaceController
{
public ActionResult TestAjaxCall()
{
var result = "Test result from controller";
return Json(result);
}
}
I figured out what was happening. It is a bit embarrassing, but I hope it is useful to someone else in the future. I had to take "Controller" out of the url.
Ajax call to Surface Controller Action 404 Error
I'm tying to implement a cascading dropdown on a form. When the user selects a value from one select list, an AJAX call is made to retrieve the data to fill a second dropdown. This is an Umbraco form in a partial view rendered with an @Html.Action and a child [HttpGet] method to populate it. This part is working, but mention it for reference.
In my view, I try to issue an AJAX post request to '/Umbraco/Surface/{surface-controller-name}/{action-method-name}" when the dropdown changes, but I get a 404 Not Found error.
I'm new to Umbraco. Any help would be much appreciated.
In Surface Controller...
In my view...
I figured out what was happening. It is a bit embarrassing, but I hope it is useful to someone else in the future. I had to take "Controller" out of the url.
I figured it out by listing out all the routes using the following code:
is working on a reply...