O
ofiras
Hello,
I made an AJAX script that gets data from a PHP file, and feeds a div
with this data. The PHP file is sending data in Hebrew, but the AJAX
somehow feeds the div with question marks instead of letters. Dose
someone knows why is it so?
This is my AJAX script:
//Script start
function getHTTPObject(){
if (window.ActiveXObject)
return new ActiveXObject('Microsoft.XMLHTTP');
else if (window.XMLHttpRequest)
return new XMLHttpRequest();
else {
alert('Your browser does not support AJAX.');
return null;
}
}
function doWork(){
httpObject = getHTTPObject();
if (httpObject != null) {
httpObject.open('GET', 'online_users.php', true);
httpObject.send(null);
httpObject.onreadystatechange = function(){
if(httpObject.readyState == 4){
document.getElementById('div1').innerHTML = httpObject.responseText;
}
}
}
}
doWork();
setTimeout('doWork()',30000);
//Script end
And this is the PHP file (if it matters...):
//PHP script start
<?php
print "×”×™×™";
?>
//PHP script end
And what I get is "��".
Thanks,
Ofir.
I made an AJAX script that gets data from a PHP file, and feeds a div
with this data. The PHP file is sending data in Hebrew, but the AJAX
somehow feeds the div with question marks instead of letters. Dose
someone knows why is it so?
This is my AJAX script:
//Script start
function getHTTPObject(){
if (window.ActiveXObject)
return new ActiveXObject('Microsoft.XMLHTTP');
else if (window.XMLHttpRequest)
return new XMLHttpRequest();
else {
alert('Your browser does not support AJAX.');
return null;
}
}
function doWork(){
httpObject = getHTTPObject();
if (httpObject != null) {
httpObject.open('GET', 'online_users.php', true);
httpObject.send(null);
httpObject.onreadystatechange = function(){
if(httpObject.readyState == 4){
document.getElementById('div1').innerHTML = httpObject.responseText;
}
}
}
}
doWork();
setTimeout('doWork()',30000);
//Script end
And this is the PHP file (if it matters...):
//PHP script start
<?php
print "×”×™×™";
?>
//PHP script end
And what I get is "��".
Thanks,
Ofir.