我遇到了在那裏同樣#特殊字符導致此腳本失敗的問題...使用特殊字符,如#和「在阿賈克斯URL字符串查詢
它的postvar變量包含特殊字符,
我不是很熟悉JS編程,我希望有人能告訴我處理postvar變量中的#字符所需的代碼...
謝謝!
<script type="text/javascript">
var nocache = 0;
function insert<?php echo $link; ?>() {
document.getElementById('insert_response<?php echo $link; ?>').innerHTML = "Just a second..."
var postvar= encodeURI(document.getElementById('<?php echo $link; ?>').value);
nocache = Math.random();
http.open('get','ajquery.php?postvar='+postvar+'&nocache = '+nocache+'&field='+'<?php echo $link; ?>'+'&page='+'<?php echo $_GET[page]; ?>'+'&id='+'<?php echo $_GET[id]; ?>'+'&theme='+'<?php echo $rowxxx[THEME]; ?>'+'&table='+'<?php echo $ajaxtable; ?>'+'&q1='+'<?php echo $q1; ?>'+'&q2='+'<?php echo $q2; ?>');
http.onreadystatechange = insertReply<?php echo $link; ?>;
http.send(null);
}
function insertReply<?php echo $link; ?>() {
if(http.readyState == 4){
var response = http.responseText;
document.getElementById('insert_response<?php echo $link; ?>').innerHTML = ''+response;
}
}
</script>
什麼是'$ link'? – Nanne 2012-01-16 20:20:00