i'm trying change form action based on selected value dropdown menu.based on selection want redirect function 2 different controller functions.but in code redirection not working.can 1 please me solve problem.my code
<script type="text/javascript"> $(document).ready(function () { $("#sub").click(function () { var usertype = $("#user").val(); if (usertype == 'client') { window.location.href = "<?php echo site_url('client_login/clogin'); ?>"; } else { window.location.href = "<?php echo base_url('hospital.php'); ?>"; } }); }); </script>
i'll need other related components view sure. based on what's available.
try in view
<script type="text/javascript"> $(document).ready(function () { $("#sub").click(function () { var usertype = $("#user"); var selectedusertype = usertype.options[usertype.selectedindex].value; if (selectedusertype == 'client') { window.location = "<?php echo site_url('client_login/clogin'); ?>"; } else { //redirect controller } }); });
try checking code step step placing alerts. checking if click function getting called, or if valued selected right one, , on...
hope helps.
Comments
Post a Comment