georgeA (1) [Avatar] Offline
#1
Looking for some consulting help here. I am not an admin kind of guy, just good w/jQuery, JS, CSS, HTML and PHP.
I am using jQuery to run a php script on my local 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:

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.
George Andrade
twillbefun@yahoo.com
monsur.hossain (22) [Avatar] Offline
#2
Re: Need CORS help plz...
Hi George. You might have better luck posting this question to stackoverflow.com with the tag "cors". I lurk on there, along with other CORS experts who might be able to help you. This message board is specifically for questions and feedback on the book CORS in Action.

Thanks,
Monsur