Почему после вызова аякса на серверной стороне я получаю сессию пустую?
Если же с пхп скрипта то сессия действительная
PHP:
скопировать код в буфер обмена
function ajax_post(){ // Create our XMLHttpRequest object var hr = new XMLHttpRequest(); // Create some variables we need to send to our PHP file var url = "/server/mail.php"; var fn = 777; var ln = 2; var vars = "firstname="+fn+"&lastname="+ln; hr.open("POST", url, true); // Set content type header information for sending url encoded variables in the request hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); // Access the onreadystatechange event for the XMLHttpRequest object hr.onreadystatechange = function() { if(hr.readyState == 4 && hr.status == 200) { var return_data = hr.responseText; /* document.getElementById("status").innerHTML = return_data; */ } } // Send the data to PHP now... and wait for response to update the status div hr.send(vars); // Actually execute the request /* document.getElementById("status").innerHTML = "processing..."; */ }
Может быть аякс как то на сессию влияет, объясните пожалуйста этот механизм
|