Здравствуйте.Хочу отправить массив на сервер.Подскажите,пожалуйс та, что делаю не так
function createRequestObject() {
if (typeof XMLHttpRequest === 'undefined') {
XMLHttpRequest = function() {
try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }
catch(e) {}
try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); }
catch(e) {}
try { return new ActiveXObject("Msxml2.XMLHTTP"); }
catch(e) {}
try { return new ActiveXObject("Microsoft.XMLHTTP"); }
catch(e) {}
throw new Error("This browser does not support XMLHttpRequest.");
};
}
return new XMLHttpRequest();
}
function send() {
var dat='mass='+JSON.stringify(timetable);
alert(dat);
req =new XMLHttpRequest();
if (req) {
req.open("POST", 'src', true);
req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
req.send(dat);
}
}
if (isset($_POST["mass"]))
{
$php_json = json_decode($_POST["mass"], TRUE);
for($i=0; $i<count($php_json); $i++){echo $php_json[$i]."<br>";}
}