0

如何关闭 Dajaxproject 警报“出现问题”?有时我的 dajax 函数返回空数据,因此 html 中的变量为无。它确实适合我,但是会显示 dajax 警报。我听说有 DAJAXICE_EXCEPTION 但我不知道如何正确使用它。当网站一般完成时,你会做什么?

4

1 回答 1

0

This is purely speculative, and I haven't tested this myself, but I think the place you want to look is in line 87 of dajaxice.core.js:

valid_http_responses: function(){
    return {200: null, 301: null, 302: null, 304: null}
}

The section which throws errors is in line 51:

    if(this.responseText == Dajaxice.EXCEPTION || !(this.status in Dajaxice.valid_http_responses())){
            error_callback();
    }

So maybe changing valid_http_responses to:

valid_http_responses: function(){
    return {200: null, 204: null, 301: null, 302: null, 304: null}
}

From Wikipedia:

204 No Content:
    The server successfully processed the request, but is not returning any content

Maybe that will fix your issue?

于 2013-05-22T18:06:50.400 回答