これを返すアクションがあります:
return Json(new { success = true, aaa = "bbb" }, "text/html");
aaa
onComplete関数でアクセスするにはどうすればよいですか?
onComplete: function (file, response)
{
alert(response['aaa']); //undefined
}
これを返すアクションがあります:
return Json(new { success = true, aaa = "bbb" }, "text/html");
aaa
onComplete関数でアクセスするにはどうすればよいですか?
onComplete: function (file, response)
{
alert(response['aaa']); //undefined
}
私はonComplete
jQueryに精通していません。どの Ajax メソッドを使用していますか? console.dir(reponse)
パラメータの内容を正確に確認するために、アラートの代わりに試すことができresponse
ます。
この$.ajax()
メソッドを使用すると、(「on」なしで) ハンドラーを提供したり、ハンドラーcomplete
を使用して応答を実際に処理したりできます。success
$.ajax("yourURLhere", {
success : function(data, textStatus, jqXHR) {
alert(data['aaa']);
},
complete : function(jqXHR, textStatus) {
// do something - note that the parameters don't include "data"
// like the success callback, and "complete" is called after
// the "success" or "error" callback
}
});