drl1
asked on
Ajax post- Cross domain request XDR
This is my JavaScript code to make XDR post request:
And when I try to access the variable myval in PHP:
I get the output as 'NO POST DATA'. Could anyone help me in finding what is wrong here? Many thanks.
if(isIE()) {
xdr = new XDomainRequest();
if (xdr) {
xdr.onerror = err;
xdr.ontimeout = timeo;
xdr.onload = loadd;
xdr.timeout = 10000;
xdr.open('POST', url);
xdr.send('myval=abc');
}
}
And when I try to access the variable myval in PHP:
if(isset($HTTP_RAW_POST_DATA)) {
parse_str($HTTP_RAW_POST_DATA); // here you will get variable $myval
if($myval== 'abc') {
echo "TRUE !";
}
}
else {
echo 'NO POST DATA';
}
I get the output as 'NO POST DATA'. Could anyone help me in finding what is wrong here? Many thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
By the way, there's a PHP-specific forum area here that would better answer these types of questions in the future.