I need to check if “success” is true or false. i get the following json response back from action:
{“success”:true}
how can i check it if true or false. i tried this but it doesn’t work. it comes back undefined
$.post("/Admin/NewsCategory/Delete/", { id: id }, function (data) {
alert(data.success);
if (data.success) {
$(this).parents('.inputBtn').remove();
} else {
var obj = $(this).parents('.row');
serverError(obj, data.message);
}
});
Your controller action should look like this:
Personally I would use the HTTP DELETE verb which seems more approapriate for deleting resources on the server and is more RESTful:
and then: