So I used this before, but this is a link, with that behaviour once the link is clicked
Ajax.ActionLink("XXX", "UpdateGridView", new { }, new AjaxOptions { UpdateTargetId = "configs"})
);
What I want is a function in JS doing the same, calling an Action
and given a UpdateTargetId
, it will re render that partial view with that Action
.
Is it possible?
Thank you
EDIT:
$.ajax({
type: "POST",
url: "AddUpdateConfigs",
data: ({id: @Model.QueueMonitorConfigurationsID, pathType: $('#ddlConfigTypeName').val(), threshold:$('#ddlThreshold').val(), valueType:$('#ddlValueTypeName').val(), location: $('#txtbLocation').val(), limit: $('#txtbLimit').val(), config: $('#NewOrUpdate').val() }),
dataType: 'application/json',
statusCode: {
404: function(){
alert("Data is duplicated");
},
405:function(){
alert("Location Path is not correct");
},
406: function(){
alert("Location Path has to be UNC path");
},
407: function(error){
alert(error);
},
410:function(result){
alert("Item added correctly");
$('#gridView').load('gvConfigurations');
},
411:function(result){
alert("Item updated correctly");
}
}
});
So my code works, but when my Action returns with code 410, I want to call that Action
and update the gridView gvConfigurations