答案 0 :(得分:1)
将所选选项作为查询字符串传递,然后您可以在构建时检查每个选项的值:
URL:
http://www.example.com/mypage?selectedOption=7
CODE:
<select class="form-control" onchange="refreshOrg()" id="selectTeam">
<option value="dis" disabled>Please Select a Team..</option>
<option value="1"<?php if ($_GET['selectedOption'] == 1) { echo " selected"} ?>> Platform (ALL)</option>
<option value="2"<?php if ($_GET['selectedOption'] == 2) { echo " selected"} ?>> Operations Tools</option>
<option value="3"<?php if ($_GET['selectedOption'] == 3) { echo " selected"} ?>> Big Data Platform</option>
<option value="4"<?php if ($_GET['selectedOption'] == 4) { echo " selected"} ?>> Information Integration Governance</option>
<option value="5"<?php if ($_GET['selectedOption'] == 5) { echo " selected"} ?>> Cloud Data Services</option>
<option value="6"<?php if ($_GET['selectedOption'] == 6) { echo " selected"} ?>> Relational Analytics</option>
<option value="7"<?php if ($_GET['selectedOption'] == 7) { echo " selected"} ?>> SAP CoE </option>
<option value="8"<?php if ($_GET['selectedOption'] == 8) { echo " selected"} ?>> Business Analytics Platform </option>
<option value="9"<?php if ($_GET['selectedOption'] == 9) { echo " selected"} ?>> Competetive </option>
</select>
正如@jqheart所说,在refreshOrg()中创建URL非常简单:
window.location='your_URL?selectedOption='+$('#selectTeam').attr('option :selected');
答案 1 :(得分:0)
在refreshOrg()
函数中,希望您在此函数中使用URL,并在页面中使用jquery。
在refreshOrg()
内,
location.href='your_URL?selectTeamVal='+$('#selectTeam').attr('option :selected');
答案 2 :(得分:0)
做客户端!
jQuery(document).ready(function($){
var urlMatch = document.location.search.match(/selectedOption=([^&]+)/);
if (urlMatch != null)
{
$('#selectTeam').val(urlMatch[1]);
}
});