If I run this function on another server, the php file actually runs and returns data. When I run this code in a javascript file on google cloud server, I get a string containing the contents of the php file. Is something wrong with my yaml file or is there something else that I am missing? The php file should be throwing some kind of error since I haven't set up the sql database yet.
Here's the AJAX:
$.ajax({
type: 'POST',
url: 'php/genjsonphp.php',
data: { stdt : startformat.toString(), enddt : endformat.toString()},
success: function(data) {
try
{
successSearch(data);
}
catch(err)
{
txt="There was an error on this page getting the data points.
";
txt+="Error description: " + err.message + "
";
txt+="Click OK to continue.
";
txt+=data;
alert(txt);
}
}
});
I see that 'data' is just a String of the PHP file genjsonphp.php.
EDIT: I am running the app on google-app engine. I made a mistake when I tried to describe my question. I believe my error lies in my YAML file. I have a folder that the main index.php file accesses and calls php files (or that's what it's supposed to do). I need to read up on the app.yaml to fix it I think. Here is what the files looks like now:
application: melodic-bolt-364
version: 1
runtime: php
api_version: 1
handlers:
- url: /stylesheets
static_dir: stylesheets
- url: /javascript
static_dir: javascript
- url: /fancybox
static_dir: fancybox
- url: /images_android
static_dir: images_android
- url: /php
static_dir: php
- url: /.*
script: index.php
You've got this line here:
- url: /php
static_dir: php
This means "serve everything in the PHP directory as static files." Instead, try this:
- url: /php/genjson
script: php/genjsonphp.php
That'll make the path "/php/genjson" execute your script.