Link to home
Start Free TrialLog in
Avatar of MikeDiggins
MikeDigginsFlag for New Zealand

asked on

JQuery.Post calling php script gives 404 error

I'm using a Bitnami stack to develop a site using Joomla. I need to get Javascript to call a PHP routine to return data as below.

jQuery.ajax({
  type: "POST",
  url: "landing.php",
  data: rec_id,
  success: populateFields(landing),
  dataType: "json"
});

There are no syntax errors (I can get an alert from the "Success" code) and rec_id contains data, but the URL is generated as http://puter:81/joomla/index.php/landing.php  and the call fails with

"Failed to load resource: the server responded with a status of 404 (Not Found)". The PHP file is in the root folder (same as index.php); the port of 81 is required to distinguish the Joomla site from another on the same local machine.
Any ideas, please? I should add that I'm fairly new to javascript.
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MikeDiggins

ASKER

Thank you - on both counts. I was pretty sure I was missing something simple; sometimes you just don't know what you don't know :-)
You are welcome.