Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/235.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
当我的XAJAX调用通过PHP返回NULL时——它会显示在IE上(但它应该什么也不显示),如何更正这一点?_Php_Internet Explorer_Xajax - Fatal编程技术网

当我的XAJAX调用通过PHP返回NULL时——它会显示在IE上(但它应该什么也不显示),如何更正这一点?

当我的XAJAX调用通过PHP返回NULL时——它会显示在IE上(但它应该什么也不显示),如何更正这一点?,php,internet-explorer,xajax,Php,Internet Explorer,Xajax,请查看下面的代码片段: 首先,Javascript调用: function getNewSelect(property_id){ xajax_getSelectDropDown(unique_id); $(".chzn-select").chosen(); } 接下来,PHP XAJAX函数: function getSelectDropDown($unique_id){ //CODE ABOVE THIS POINT HAS BEEN REMOVED, IT IS IRREL

请查看下面的代码片段:

首先,Javascript调用:

function getNewSelect(property_id){
  xajax_getSelectDropDown(unique_id);
  $(".chzn-select").chosen();
}
接下来,PHP XAJAX函数:

function getSelectDropDown($unique_id){
    //CODE ABOVE THIS POINT HAS BEEN REMOVED, IT IS IRRELEVENT FOR THIS EXAMPLE

        //Code for if no matches were found:
        $html2 = NULL;

        $objResponse = new xajaxResponse();
        if(mysql_num_rows($result) > 0){
            $objResponse->assign('subDiv', 'innerHTML', $html);
        }else{
            $objResponse->assign('subDiv', 'innerHTML', $html2);
        }

        $objResponse->script("$('.chzn-select-ajax').chosen();");

    return $objResponse;
}
最后是HTML代码:

<div id="subDiv"></div>

现在,当上面的PHP函数进入
else
并分配
$html2
时,我希望不会向用户显示任何内容。在大多数浏览器上,这很好,而且工作得非常完美。不幸的是,在internet explorer(IE 9,我可以确认,我还无法测试其他版本)上,它实际上在DIV调用的位置显示以下内容:

空的

如果找到了一个结果,但它没有处理
else
,那么它在所有浏览器上都能正常工作,并按预期显示一个新的下拉列表

我能做些什么来解决这个问题?这是IE的已知问题吗?谢谢

我想添加,这样就不会产生混淆,CHZN调用只是为了在下拉列表中添加一个样式,如下所示:

最好使用这个:

    if(mysql_num_rows($result) > 0){
        $objResponse->assign('subDiv', 'innerHTML', $html);
    }else{
        $objResponse->assign('subDiv', 'innerHTML', '');
    }
IE显示null是因为$html2=null……最好用$html2=”“或类似的东西试试;)


萨卢多斯。

哇,真是太容易了。谢谢