Grocery Crud url 通过 javascript 重定向

Grocery Crud url redirection via javascript

我正在尝试在编辑屏幕的保存按钮上对杂货店垃圾使用自定义重定向。我可以使用 URL 片段成功重定向,如下例所示:

$the_catalogue_id = $this->uri->segment(count($this->uri->segments));    
$this->grocery_crud->set_lang_string('update_success_message',
             'Your data has been successfully stored into the database.<br/>Please wait while you are redirecting to the list page.
             <script type="text/javascript">
              window.location = "'.base_url('catalogues/edit').'/'.$the_catalogue_id.'";
             </script>
             <div style="display:none">'
        );

我现在需要将 window.location.hash 添加到重定向 URL 的末尾,但似乎无法正常工作。这是我目前所拥有的:

$this->grocery_crud->set_lang_string('update_success_message',
         'Your data has been successfully stored into the database.<br/>Please wait while you are redirecting to the list page.
         <script type="text/javascript">
         var thehash = window.location.hash
          window.location = "'.base_url('catalogues/edit').'/'.$the_catalogue_id.'"#"+thehash";
         </script>
         <div style="display:none">'
    );

如何将散列变量添加到重定向的末尾 URL?

"+thehash" 中删除双引号。

连接运算符和变量不应在生成的 javascript.

中用双引号引起来
   var thehash = window.location.hash;
   window.location = "'.base_url('catalogues/edit').'/'.$the_catalogue_id.'#"+thehash;