我設法改變了kendoGrid.dataSource.transport.options.create.url的端點,并將其重定向到一個不同的端點
是否有辦法改變這個代碼中的e.response和e.type?
是否有辦法改變這段代碼中的e.response和e.type? 代碼如下。我說的是 requestEnd 的回呼引數
有什么辦法可以改變代碼中的 e.response 和 e.type 呢?
requestEnd。function (e) {
var response = e.response;
var type = e.type;
console.log(e, 'I am event'/span>)。
console.log("i triggered again and i am response", response)。
console.log("i am type", type)。
return 0;
if (type !== "read") {
toastr.options = {
positionClass: "toast-top-right"。
};
if (type === 'update') {
if (! response.success) {
toastr.error(response.errorMessage, 'Account Update') 。
} else {
toastr.info('Account detail successfully updated', 'Account Update') 。
}
} else if (type === 'create') {
if (! response.success) {
toastr.error(response.errorMessage, 'Message') 。
} else {
toastr.info('New Account successfully added', 'Message') 。
}
}
$('#grid').data('kendoGrid').dataSource.read)。
$('#grid').data('kendoGrid').refresh()。
}
},
我真的很感謝你的幫助!任何能夠幫助我的人都應該得到加薪:)
uj5u.com熱心網友回復:
我將改變方法來解決這個問題。你可以根據complete部分的型別來捕獲每個請求的回應。在控制臺記錄response和errorThrown,看看你從服務器得到什么
transport: {
讀取: {
url: ''/span>,
type: 'GET',,
contentType: 'application/json'。
complete: function(response, errorThrown) {
if (errorThrown === 'error'/span>) {
toastr.error(response.errorMessage, 'Account Read')
} else {
var responseData = response.responseJSON.accounts; //presumably array of accounts[/span
toastr.info('Acounts fetched', 'Account Read') 。
}
}
},
update: {
url: ''/span>,
type: 'POST'。
contentType: 'application/json',
complete: function (response, errorThrown) {
if (errorThrown === 'error'/span>) {
toastr.error(response.errorMessage,'Account Update')
} else {
toastr.info('Account detail successfully updated', 'Account Update') 。
}
}
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/323089.html
標籤:
上一篇:維基百科下載圖片時的用戶代理問題
