Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/474.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
Php Javascript只适用于chrome和FireFox,不适用于IE_Php_Javascript_Jquery - Fatal编程技术网

Php Javascript只适用于chrome和FireFox,不适用于IE

Php Javascript只适用于chrome和FireFox,不适用于IE,php,javascript,jquery,Php,Javascript,Jquery,我最近一直被IE9 bug难住了。我有这个功能 //return value in the admin/user select in url to get result via $_GET when page reloads function toggleView() { //parse url to remove all parameters other than ghost_id var url = window.locatio

我最近一直被IE9 bug难住了。我有这个功能

        //return value in the admin/user select in url to get result via $_GET when page reloads
       function toggleView() {
        //parse url to remove all parameters other than ghost_id
         var url = window.location.href.split("&")[0];
         var view_type = $("#toggle_view").val();
        //reload page with view type selected 
         window.location.href = url+"&view_type="+view_type;    
        }
这个函数的作用是删除url中的参数,用一个新参数替换它们,然后重新加载页面,这样我的php在重新加载时可以通过$\u get获得新值


这在Firefox和Chrome中可以完美地工作,但在IE9中甚至没有调用javascript函数。我想知道在jQuery或其他javascript中是否有另一种方法来解决IE9问题。

如果您想删除所有参数,应该在“?”上拆分,而不是在“&”上拆分。

通常,当出现错误时,所有javascript都会在该点停止。

因此,该函数可能没有问题,代码中的其他地方也可能有错误。

如果没有调用该函数,我们需要查看您试图调用它的代码。我的钱在某个散列定义中的尾随
,没有看到调用该函数的内容,我猜您试图调用此函数的事件在Internet Explorer中不起作用。@prodigitalson我想他们在IE 8中解决了这个问题。我在这里没有看到错误。除了你要解决为什么这个函数不会在IE中被调用,而是在FF/Chrome中被调用(看起来很奇怪…),你还可以检查你得到的url,并将类型数据视为你的函数项。“
//解析url以删除除ghost\u id**
”以外的所有参数**——这里的错误是假设ghost\u id将是第一个参数。啊,你说得对,描述和评论有出入。