ajax XMLHttpRequest work with php

edited 十月 2013 in Javascript
大家好~我利用ajax xmlhttprequest 在image_model2_check.php拿一些資料, 當palylist 的 value 是英文時 ,在firefox, ie8 ,function writecontent 都能夠順利運行, 但當playlist 的value 是中文, 這function 就只能夠在firefox成功運行..我知道可能是編碼的問題,請問該如何解決這問題?

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> --> 網頁是用 utf8
function writecontent(num){
var index = num + 1;
var playlist = '<?php echo $_GET ?>';
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp1=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp1=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp1.onreadystatechange=function()
{
if (xmlhttp1.readyState==4 && xmlhttp1.status==200)
{
var type = xmlhttp1.responseText;
}
}
xmlhttp1.open("GET","image_model2_check.php?index="+index+"&playlist="+playlist+"&action=getType",true);
xmlhttp1.send();

原始討論: http://twpug.net/x/modules/newbb/viewtopic.php?topic_id=5310
Sign In or Register to comment.