0

I am sorry for this post, But i do not understand why my code is not working. I have table with checkbox in every row and top of table a edit button. I want to select a row and want to edit by clicking edit button. Please see my code in else condition. I have tried window.location , window.location.replace, window.location.href but nothing working. Please help.

$('#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";
                }
        });
Treadstone
  • 39
  • 1
  • 10
  • cross check whether it is coming in your else or not. also print value for http://lc/edit – Sandip Pingle Jan 29 '14 at 07:02
  • `console.log("http://lc/edit");` check your browser console !!!!!!! – rynhe Jan 29 '14 at 07:08
  • Probably you will get the answer from http://stackoverflow.com/questions/503093/how-can-i-make-a-redirect-page-in-jquery-javascript – Syd Jan 29 '14 at 07:10

1 Answers1

0

Try this:

 window.location = "http://" +  <?php echo base_url();?> + "lc/edit";
Sudharsan S
  • 15,336
  • 3
  • 31
  • 49