Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

219
Views
Apache Server PHP works in address bar, but not when using AJAX from Javascript?

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!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The answer to this question was that I was not allowed to use HTTP to communicate with the apache server, and it has to be secured with SSL to use HTTPS. I tried using a Self-Signed certificate, but the self-signed version was also not allowed for use with a Captivate Course.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!