just using vanilla javascript is it possible to send data to a php server without appending it to the url?
here's what I have so far:
function getAjax(url, success) {
var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
xhr.open('GET', url);
xhr.onreadystatechange = function() {
if (xhr.readyState>3 && xhr.status==200) success(xhr.responseText);
};
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.send();
return xhr;
}
getAjax('http://localhost/login/public/login.php?email=someone@gmail.com',
function(data){ console.log(data); });
can I add $_GET parameters in xhr.send()? or is there another way to send this object along with the request:
data = {email:'someone@gmail.com',
password:'compas'}