【发布时间】:2016-07-28 11:31:34
【问题描述】:
我正在尝试在编辑屏幕上的保存按钮上对杂货杂货使用自定义重定向。我可以使用 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 的末尾?
【问题讨论】:
标签: javascript php codeigniter grocery-crud