如果以下可能? 我希望將警報(結果)移入函數並動態調用它。用javascript在param中執行動態功能
當前
$.ajax(this.href, {
success: function (result)
{
alert(result);
AjaxComplete();
}
});
我嘗試 - 不工作
$.ajax(this.href, {
success: function (result)
{
window["MyAlert(result)"]();
AjaxComplete();
}
});
function MyAlert(result)
{
alert(result);
}
這可能嗎?
因爲我想將函數存儲在屬性中。 data-ajax-onsuccess-withparam –
然後我的第二個代碼塊將工作。 – Blender
作品,非常感謝你! –