在javascript函数中重定向,coeigniter [英] Redirect in javascript function, coeigniter

查看:132
本文介绍了在javascript函数中重定向,coeigniter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下函数将显示一个弹出消息,一旦用户点击确定它将导航用户到控制器称为backendBanner并调用函数delete_banner。

I have the following function that will show a pop up message, once the user click ok it will navigate the user to the controller called backendBanner and call the function delete_banner.

用html和php写的链接看起来像这样:

The link written in html and php looks something like this:

<a href="<?php echo base_url().'backendBanner/delete_banner/'.$banner['banner_path']; ?>">

视图中调用函数的代码

<td>
      <a onclick="return remove_image($(this));" rel="<?php echo $banner['banner_path']; ?>"><input type="button" class="btn btn-danger" value="Delete"></a>
</td>

函数的代码
在此函数中,$ banner ['banner_path']到全路径

Code for the function In this function, $banner['banner_path'] is equal to fullpath

<script>
        function remove_image(img)
        {
            if(confirm('<?php echo lang('confirm_remove_image');?>'))
            {
                var fullpath  = img.attr('rel');
                alert(fullpath);
                redirect(base_url()."backendBanner/delete_banner/"+fullpath);
            }
        }
    </script>

如何让用户通过该功能链接?

How should I go about bringing the user to the link through the function?

推荐答案

应该是:

window.location="<?php echo base_url().'backendBanner/delete_banner/'.$banner['banner_path']; ?>" + fullpath

这篇关于在javascript函数中重定向,coeigniter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆