我正在使用uploadify在我的ASP.NET MVC應用程序上載.csv文件。從控制器動作我返回一個JSON像這樣一對夫婦值:如何從控制器動作捕獲返回值
return Json(new { success = false, message = result.Message });
以下是uploadify代碼:
$("#email").uploadify(
{
'uploader': '/js/component/uploadify/uploadify.swf',
'script': '/email/UploadEmail',
'cancelImg': '/js/component/uploadify/cancel.png',
'fileExt': '*.csv',
'fileDesc': '*.csv',
'auto': true,
'multi': false,
'buttonText': 'Upload...',
'onComplete': function (event, queueID, fileObj, response, data)
{
alert(jQuery.parseJSON(response));
alert(jQuery.parseJSON(response.message));
var filename = fileObj.name;
$('#emailSuppressionFile').append('<input id="' + queueID + '" type="hidden" name="files[' + queueID + ']" value="' + filename + '" />');
}
});
我想讀,我從返回的「消息」控制器的行動,但無法弄清楚如何。請參閱上面的警報。第一個警報返回:[object Object],第二個返回null。
感謝您的答覆。我試過了,但結果仍然返回null。 – dotNetNewbie
'response.responseText'的價值是什麼? –
response.responseText未定義,結果然後計算爲null。 – dotNetNewbie