Я использую ajax для запроса. Я передаю параметр key
и модель в метод контроллера, но я могу получить ключ метода, но получение значения модели всегда равно нулю, когда я устанавливаю значение traditional
true и 0, когда я отправляю это без традиционного.
Вот мой метод ajax.
$('.search-hot-destination').on('click', '.rightdesti-list > a', function () {
var key = $(this).parents('li').find('.countryNameList').attr('id');
var model ={
DestinationCityID: $(this).attr('id')
}
$.ajax({
type: "GET",
url: "/Home/destination",
data: {key: key, model:model},
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
alert('hello');
}
})
});
Вот мой метод управления.
public ActionResult destination(string key, FilterDataViewModel model, string searchingkey, int skip = 0)
{
}
Вот моя модель.
public class FilterDataViewModel
{
public int ItemID { get; set; }
public string SearchingKey { get; set; }
public int DestinationCityID { get; set; }
public int citykey { get; set; }
}