Need help with CORS - can't get by it

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Need help with CORS - can't get by it

Postby gilblais » 22. November 2013 12:20

I am using jQuery to run a php script on my LOCAL ONLY Apache server under xampp 1.8.3, PHP 5.5.0

I have added the following to my httpd.conf file at the end.

<Directory />
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Headers "Content-Type"
Header set Access-Control-Allow-Methods "GET, PUT, OPTIONS, DELETE, POST"
</Directory>

<Directory "C:/xampp/htdocs/yankeebeds">
AllowOverride All
Options None
Require all granted
</Directory>

And, I absolutely cannot get this PHP file to execute - always get null back for data:
print_r(''); print_r($_POST); print_r(''); <== this will print what was sent from the client and it does nothing
echo('pageChanger.php says: postedParms=' . $_POST['postedParms']); ?> <== this is what goes back to jQuery when working

The HTML is: <a onclick="runOnServer('pageChanger.php','HOME.html');">

The jQuery call is: function runOnServer(whatToRun, parameters) {
alert('at runOnServer with ==>' + whatToRun + ' and ' + parameters); <== this works - tells me it is going to the server side
var posting = $.post(whatToRun, { postedParms: parameters }); <== this is the jQuery call to the server
posting.done(function(data) {
//var data1 = jQuery.parseJSON(data); ,== this didn't work either
alert("What we got back:" + data); <== this should print something, but debug always shows null cam back with the standard CORS access denied message
});
}

I put this here cuz I am trying to develop a WEB presence on my local machine and can't even over-ride CORS on it.
I know it is me, but I am definitely stumped. Any help is well appreciated.
gilblais
 
Posts: 3
Joined: 22. November 2013 12:08
Operating System: windows 7

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 37 guests