I have created an Apache server on an EC2 instance that I am using to host a mySQL database and some PHP scripts to access that database. I have installed what I think are the all of the required dependencies on the Apache server, to the point where when I write a PHP script and access it via a web browser using the address bar, the PHP script runs, queries my database and returns the correct information to the web browser.
However, the goal of the scripts is to be used by a Javascript application to access the database via AJAX, specifically a Captivate course. When I try to use AJAX to access the scripts, nothing happens. Captivate gives very little information about error logging, so I have tried using other services to check my javascript to make sure it is working, such as jsfiddle.net, but it seems like the Javascript is not the problem. Here is my code:
function httpGet(theUrl)
{
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
xmlHttp.send();
alert(xmlHttp.responseText);
}
My goal is not necessarily to use Alert to post the code to the screen, I'm using it just to check if I got anything back in the first place. theUrl leads to a php script on the other end called simpleecho.php:
<?php
echo "test";
?>
I have more complicated PHP scripts, but they also all work in browser. If I go to theUrl in an address bar of a web browser, I see "test". I have tried changing from Async requests to Sync, I am certain that Captivate's javascript can use jQuery related code, I have tried like 8 different ways of sending the AJAX request as both POST and GET, but I'm not sure what I am missing. My gut says there is something wrong configured with the Apache server that is keeping it from responding to specifically requests outside of my address bar, but I don't know enough about configuring my httpd.conf file to know what I am looking for.
Any and all tips and learning is appreciated!