I am using Asp.net MVC and I would like to send a get request along side with model. I am sure this can be done via post request be in this case I will not get data back.
So my request is:
$.ajax({
type: "GET",
url: '@Url.Action("ActionName", "Controller")',
data: {model: { model1: {id:1,name:"Test1"}, model2: null, model3: null }, serverName: "ServerTest"
},
datatype: "json",
cache: false,
success: function (data) {
$("#table1").html(data);
},
error:function (xhr, ajaxOptions, thrownError){
alert(xhr.responseText);
}
});
Action:
public ActionResult TestSpecSearchResult(MainModel model, string serverName)
{
//Do somethin
return PartialView(data);
}
Please note MainModel contain model1,model2 and model3.