[英]Passing a value through $_GET with jquery function
我想使用jQuery函數通過$_GET
傳遞一個下拉值
這是我的代碼:
<div class="span2 text-right">
<label class="f-s15">Choose Exam to take:</label>
</div>
<div class="span3">
<select name="test_tag" id="test_tag">
<?php
foreach($array2 as $value2){ ?>
<option value ="<?php echo $value2['_id']; ?>"><?php echo $value2['score_type']; ?> </option>
<?php
}
?>
</select>
這是我的jQuery函數:
function passTag() {
var selectedvalue = jQuery('#test_tag').val();
location.href="test_new.php?id="+selectedvalue;
}
現在當我print_r($_GET)
,我什么也沒得到...
嘗試這個
jQuery(document).ready(function(){
jQuery("#test_tag").change(function(){
var selectedvalue = jQuery('#test_tag').val();
location.href="test_new.php?id="+selectedvalue;
})
})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.