dpdkqls6399 2016-01-22 14:38
浏览 44
已采纳

重定向javascript函数,codeigniter

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.

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

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

Code for the button in view to call the function

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

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?

  • 写回答

3条回答

  • duanbanfei2875 2016-01-22 15:25
    关注

    It should be :

    window.location="<?php echo base_url().'backendBanner/delete_banner/'.$banner['banner_path']; ?>" + fullpath
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退
  • ¥20 win系统的PYQT程序生成的数据如何放入云服务器阿里云window版?