我很抱歉这篇文章,但我不明白为什么我的代码不起作用。我在表格的每一行和每个表格的顶部都有一个编辑按钮。我想选择一行,然后点击编辑按钮进行编辑。请在其他情况下查看我的代码。我试过了 window.location,window.location.replace,window.location.href但没什么用。请帮忙。
$('#lc_edit_btn').click(function(){
var countchecked = $('table input[type="checkbox"]').filter(":checked").length;
if(countchecked<1){
alert('You didn\'t select any item.');
}else if(countchecked>1){
alert('You can can not edit more than one item at a time.');
}else{
window.location = "http://<?php echo base_url();?>lc/edit";
// similar behavior as an HTTP redirect
window.location.replace("http://<?php echo base_url();?>lc/edit");
// similar behavior as clicking on a link
window.location.href = "http://<?php echo base_url();?>lc/edit";
}
});
答案 0 :(得分:0)
试试这个:
window.location = "http://" + <?php echo base_url();?> + "lc/edit";