dousuo8400
2014-07-25 16:55
浏览 63
已采纳

从php视图文件将变量传递给javascript

I am developing a web application where you can delete users. I am using codeigniter framework to develop this. Using this code, I am invoking "Doconfirm()" function in external javascript file.

      //my view file
      <img src="<?php echo base_url(); ?>Assests/Images/cross.png" alt="Delete User"  title="Delete User" onClick="return Doconfirm()();" >

      //inside DoConfirm function javascript file
      window.location =  site_url +"user/deleteusers/id";

I want to pass id from the view to javascript doconfirm function. I know I can take the id using this php code.

      <?php echo $row['id']; ?>

What I want is to pass the id to the external javascript function "Doconfirm()" from the view. Any help will be highly appreciated.

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题