0
这里是我的代码:原型的Ajax.Updater更新之前评估串
new Ajax.Updater('container', url, {
method: "get",
onLoading: function() {
document.getElementById('container').innerHTML = "Loading...";
},
on200: function(response) {
if(response.responseText.match(/WhatImLookingFor/)) {
window.location = "leNewURL";
}
},
onComplete: function(response) {
//do other cool stuff
}
});
我试图做的是拦截container
前的响应更新,并且如果在响应中的文本相匹配WhatImLookingFor
,我想将用户重定向到leNewURL
。随着上面的代码正在发生,但不是更新之前,所以它看起来古怪。无论如何,我可以在更新发生之前拦截,或者我不得不求助于其他黑客,比如隐藏container
,只有在没有匹配的情况下才显示它。
我怀疑这是我所要做的,但希望有钩子在那里...无论哪种方式,谢谢 – rantsh 2013-03-27 13:29:22