我正在通过以下方式发送 ajax 调用:
var response = sendViaAjax(str,'Session/delete_From_Session_AJAX.php') ;
alert('response:|'+response+'|') ;
if(response == 'complete') {//returns complete if the table was not to be rewritten
el = this ;
while(el.tagName !== 'TR'){
el = el.parentNode ;
alert(el.tagName) ;
}
removeChildren(el) ;
removeElement(el) ;
}else if(response!= 'complete') {
alert(response+' is not equal to complete') ;
parseHTMLStr(response,window.cur_tbl,1,0,0) ;
}
来自 delete_Session... 的相关代码是
if( isset($_POST['REWRITE']) ) {
include("return_Tabular_Data.php") ;
}else{
echo 'complete' ;
}
我从格式化字符串中得到的警报是:
complete
is not equal to complete
必须添加一些东西,但我找不到在哪里。我广泛使用此功能,从未遇到过类似问题。
我在 sendViaAjax 中修改响应的唯一地方是
var RESPONSE = xmlhttp.responseText ;
RESPONSE = RESPONSE.replace(/^\s+/, '');
return RESPONSE ;