這裏是我的JavaScript方法:
function AssignDebtor(e) {
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
var debtorId = dataItem.Id;
$.post({
url: '@Url.Action("AssignDebtorToUnallocatedReceipt", "Debtor")',
data: new { unallocatedReceiptId : cdcUnallocatedReceiptId, debtorId : debtorId },
success: function (result, textStatus, jqXHR) {
if (result.success) {
var window = $("#LookupDebtorWindow").data("kendoWindow");
window.close();
var grid = $("#UnallocatedReceiptsGrid").data("kendoGrid");
grid.dataSource.read();
}
else {
alert(result.error);
}
},
dataType: 'json'
});
}
在運行時,調試器停止在$。員額線,並返回此錯誤:
0x800a01bd - JavaScript runtime error: Object doesn't support this action
debtorId成功獲得其價值。在我構建該方法的過程中,可能存在問題嗎?
你有jQuery鏈接? – 2013-03-12 11:59:11
它發生在你的成功函數內部,還是僅僅是發佈聲明本身? – mattytommo 2013-03-12 12:10:16
@JohnEcho是的jquery是鏈接的,因爲代碼肯定不會得到儘可能沒有jquery(使用Kendo UI - 這種方法是什麼得到執行後點擊自定義網格命令按鈕) – 2013-03-12 12:21:14