How can I set a jQuery.click variable to use on page reload?

As the page progresses, I select the matte image frame - this part works. What I want to do: Say matting is set to 1 mat and frame is set to Frame8, if I decide I want 2 mat, how can I load frame8 on page reload. It now reverts to the default frame. JQuery and php are used in the page.

in the title:

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

      

in body:
Javascript var is set here which frame I pressed -

$('#frame$frame_id[$i]').click(function() {  
    $('#top-left-frame').html('<img src=\"$upper_left[$i]\" alt=\"\" />');  
    $('#top-mid-frame').css('background-image','url($upper_middle[$i])');   
    $('#top-right-frame').html('<img src=\"$upper_right[$i]\" alt=\"\" />');  
    $('#mid-left-frame').css('background-image','url($middle_left[$i])');   
    $('#mid-right-frame').css('background-image','url($middle_right[$i])');   
    $('#bottom-left-frame').html('<img src=\"$bottom_left[$i]\" alt=\"\" />');  
    $('#bottom-mid-frame').css('background-image','url($bottom_middle[$i])');   
    $('#bottom-right-frame').html('<img src=\"$bottom_right[$i]\" alt=\"\"   />');
    $('#frame-select').html('$prod_id');
    $('#pid-form').val('$frame_id[$i]');
    $('#oa_id-form').val('$prod_id');
    var frameState = $(this).attr('id');
    alert(frameState + ' was clicked.');


});  


<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>  
         <tr>
<td>
            Double Mat: <input type="radio" name="mattes-radio" <?php if($_GET['mattes'] == 2){ echo 'checked="checked"';} ?> id="mattes-radio-2"> 
         </td>
          </tr>  
 <tr>
         <td>
            Triple Mat: <input type="radio" name="mattes-radio" <?php if($_GET['mattes'] == 3){ echo 'checked="checked"';} ?> id="mattes-radio-3"> 
         </td>

         </tr>

      

0


a source to share


1 answer


Setting up a cookie and reading it on page load is probably the easiest option.



0


a source







All Articles