Is it possible to return false and a additional datatype(like int, bool etc) from controller back to Ajax?
$.post('/Home/SomeAction', { "id": Id }, function (data) {
if (data) {
...
}else if(data.anotherBool == true){
//....
}
I need three values for tree different purpose, true, false, and another boolean.
public JsonResult SomeAction(int id) {
........
return Json(false, anotherBoolean); //<-- what I want
}
Best Answer
Yes you can do that by using
JSON
. Try something like this from your controller:Additionally, you can get the values in your Ajax call like this: