我正在嘗試将生成的
HTML字元串傳回到視圖,以動态生成帶有結果的HTML表.我無法獲得傳回的HTML字元串任何建議和幫助非常感謝.
這是我的控制器代碼
public ActionResult ValidateTrams()
{
string html = "";
if (Request.Files.Count == 0 || Request.Files[0].ContentLength == 0)
{
}
else
{
html = ProcessTextFile(Request.Files[0].InputStream);
}
return View(html);
}
我試圖像這樣在jquery中擷取這個傳回的結果
$('#tramsView').live('click',function () {
$.ajax({
url: '/Booking/ValidateTrams',type: 'POST',dataType: 'jsonp',success: function (data) {
alert(data);
$('#TramsViewFrame').html(data);
},error: function (jqxhr,textStatus,errorThrown) {
$(window).hideWaitScreen();
if (confirm(errorThrown)) { window.location.reload(); }
}
});
});
最後,下面是表單的CSHTML.在這裡,我正在從提示按鈕類型的表單中讀取檔案
id="frmvalidate">
Display rows that were NOT parsed |
VIEW |
感謝您的時間,非常感謝您的幫助.親切的問候!!!