我需要添加我自己的小if,并在里面签入3个函数
misc/ajax.js (
Drupal.ajax.prototype.beforeSend,
Drupal.ajax.prototype.success,
Drupal.ajax.prototype.error
)我如何在我的模块中覆盖它们?我找不到手册,在开发人员的例子中也没有。对不起,如果这似乎是一个愚蠢的问题,但我是一个php开发人员-我可以使用js,但我不太熟悉它。
发布于 2013-05-14 14:06:41
Drupal.ajax.prototype.beforeSend和其他变量只是碰巧有函数分配给它们的变量。只要您的代码出现在初始函数实现之后的页面构建中,您就应该能够覆盖已经存在的内容:
(function($) {
// In mymodule.js, which appears after ajax.js in the page build
Drupal.ajax.prototype.beforeSend = function(xmlhttprequest, options) {
// Replacement code.
}
})(jQuery);https://drupal.stackexchange.com/questions/73024
复制相似问题