I have an action which is returning this:
return Json(new { success = true, aaa = "bbb" }, "text/html");
How can I access aaa in my onComplete function?
onComplete: function (file, response)
{
alert(response['aaa']); //undefined
}
I’m not familiar with
onCompletein jQuery. Which Ajax method are you using? You could tryconsole.dir(reponse)in place of your alert to see exactly what is in theresponseparameter.The
$.ajax()method lets you provide acompletehandler (without the “on”), or to actually process the response I’d use asuccesshandler: