i just created ajax script which sends data to php file but, something is wrong coz when i send javascript var variable "browserLang ", i get an error that not defined. Here is my javascript:
function SetLang()
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
var browserLang = navigator.language || navigator.userLanguage;
xmlhttp.open("POST","style/wps-light/datalife3.php",true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send("BrowserLang=" + encodeURIComponent(userLang));
}
So what am i doing wrong?