Rebuild frameset using jquery

ok so I am collecting the variable below via javascript.

var frameState = $(this).attr('id');

      

I have a radio channel that doesn't pick rugs or one rug. When a cell is selected, it reloads the page where I want to put the framestate variable in the url: Sidenote - the code may not look good, but it all works, I just don't know how to add the variable to the url after the radio selection is selected.

  <tr>  
     <td>
        No Mats:  <input type="radio" name="mattes-radio" align="middle"<?php if($_GET['mattes'] == 0){ echo 'checked="checked"';} ?> id="mattes-radio-0"> 
     </td>
     </tr>  
     <tr>
     <td>
        Single Mat: <input type="radio" name="mattes-radio" <?php if($_GET['mattes'] == 1){ echo 'checked="checked"';} ?> id="mattes-radio-1"> 
     </td>
      </tr>


  $('#mattes-radio-0').click(function() {  
window.location = 'index-custom.php?mattes=0'; 
  });        

  $('#mattes-radio-1').click(function() {  
window.location = 'index-custom.php?mattes=1';

      

+1


a source to share


1 answer


If I misunderstood your question ...

This is the easiest way to do it



<input type="radio" id="mattes-radio-0" />
<script>
$("#mattes-radio-0").click(function(){
var param = $(this).attr('id').replace("mattes-radio-","");
window.location = 'index-custom.php?mattes='+param+'&framestate='+framestate;
});
</script>

      

Hope it helps

0


a source







All Articles