在第 1 页上,我尝试通过 url 将一些参数传递给 page2。我想启动 page2 并选择选项,就像我在 page2 上选择它们一样。
如何从第 1 页传递 #divOptionToTake、#divSelectChannel_btnSubmit、#selected_channel_new、#selChannels、#frmSelectChannel 并执行它?谢谢。
第1页
...../page2.php?selected_channel=facebook&option_to_take
第2页
<html>
  <script type="text/javascript">        
    $(document).ready(function() {
        <?php if($option_to_take == ""){ ?>
        $.blockUI({ message: $('#divOptionToTake'), css: { width: '420px' } }); 
        <?php } ?>
        // SELECT CHANNEL
        $('#divSelectChannel_btnSubmit').click(function() {                
            $.unblockUI();
            $('#selected_channel_new').val($('#selChannels').val())
            $('#frmSelectChannel').submit();
            //return true;               
        });            
    });  
  </script>
</html>
表格的代码在这里。
<form name="frmSelectChannel" id="frmSelectChannel" action="" method="POST">
<input type="hidden" name="task" value="select_channel" />
<input type="hidden" name="option_to_take" value="new campaign" />
<input type="hidden" name="selected_channel" id="selected_channel_new" value="facebook" />
<div id='divSelectChannel'>
        <select id='selChannels' class='span3'>
                        <option value="facebook" <?php echo (($selected_channel == "facebook") ? "selected='selected'" : ""); ?>>facebook</option>
                        <option value="twitter" <?php echo (($selected_channel == "twitter") ? "selected='selected'" : ""); ?>>twitter</option>                                                         
        </select>
            <input class='btn btn-primary' type='submit' id='divSelectChannel_btnSubmit' value='Submit' />
          
              <input class='btn' type='button' id='divSelectChannel_btnBack' value='Back' />
        </div>
   </form>