即時通訊想要實現的是如果出現錯誤(我已經提出了一個錯誤)幷包含單詞'錯誤',然後該函數停止在它的軌道。什麼功能基本上由5個Ajax請求,當一個人成功地在其他踢..像這樣..jQuery - 停止功能
function thing() {
$.ajax({
...
...
success:
function(html){
errorGet(html);
$.ajax({
...
...
success:
function(html){
errorGet(html);
...
...
我有一個函數來代替「errorGet()」試圖阻止的功能;
function errorGet(data){
var re = /error/mgi;
if(data.search(re) == 0){
thing.stop;
}
}
但我知道thing.stop does not工作,但沒有人知道如何停止該過程?
我認爲沒有辦法破壞父母功能。 – 2010-02-08 16:04:50
似乎有一個更大的問題,正則表達式不起作用...嗯,不能看到爲什麼壽。 – 2010-02-08 16:16:31
你確定(通過Firebug)「錯誤」真的在響應體中嗎?無論如何,我會親自使用「/error/mi.test(data)」,它返回true或false;你並不需要「g」標誌。 – Pointy 2010-02-08 16:27:48