I have the following code in my MVC controller:
[HttpPost]
public PartialViewResult GetPartialDiv(int id /* drop down value */)
{
PartyInvites.Models.GuestR
this line is not true: url: "@Url.Action("GetPartialDiv/")" + $(this).val(),
$.ajax
data
attribute is already included route value. So just define url in url
attribute. write route value in data
attribute.
$(".SelectedCustomer").change( function (event) {
$.ajax({
url: '@Url.Action("GetPartialDiv", "Home")',
data: { id : $(this).val() /* add other additional parameters */ },
cache: false,
type: "POST",
dataType: "html",
success: function (data, textStatus, XMLHttpRequest) {
SetData(data);
}
});
});