Working fine on localhost, not on server. PHP AJAX

TRG00
TRG00 used Ask the Experts™
on
HI
We have programmed a web application, for ordering food.
It is written in php5, javascript, mysql and implements ajax.
It works perfectly on my localhost, but if i upload it to the server and try it there it simply does not work.
I also dont know where to start looking for errors.

Address of uploaded site:
www.nutrixfoood.co.za

Any suggestions what i can try, let know if you need more info,
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2004

Commented:
>>> We have programmed a web application, for ordering food.

You're my hero!  

Are you in Linux or Windows?  Have you seen anything interesting in your PHP error log or your web server's error log?  Does the site not come up at all, or are you getting HTTP error messages?
One of the security features that browsers implement is that the HTTP Request calls cannot be sent to a different server than the original page was served from. For example, if your page is served at "http://www.mymaindomain.com", you cannot initiate HTTP Requests to "http://www.myotherdomain.net". This is fairly straightforward, and you should be able to determine fairly easily if this is the case.

A part that is a little trickier, however, is if your page is served from 'www.mymaindomain.com', but your HTTP Request are directed to 'mymaindomain.com'. The browser considers this to be a different domain, and will block the request.

If neither of the above are the cause of the issue, use Firefox and take a look at the Javascript console (on the Tools menu). This will contain helpful debugging information if your script is generating errors.

Author

Commented:
My localhost is on windows Apache, but think to is running Linux also Apache.
The site is displaying but it is not retrieving the HTTP requests. Can it by that the server is running different version of PHP.
My URL are relative so it should not call a different server.

Here is a section of my AJAX,js

function GetFromServer(xmlRequest, targetID)
{
      url = "Control/Control_Interface.php";
      startWait(targetID)
      //alert("THE FOLLOWING REQUEST WILL NOW BE SENT TO THE SERVER:\n\n" + xmlRequest)
      var xmlHttp = new GetXmlHttpObject()
      if (xmlHttp==null)
        {
        alert ("Browser does not support HTTP Request")
        return
        }
      xmlHttp.open("POST",url,true)
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
      xmlHttp.setRequestHeader("Content-length", xmlRequest.length)
      xmlHttp.setRequestHeader("Connection", "close")
      xmlHttp.send("xml="+xmlRequest)      
      
      xmlHttp.onreadystatechange=function()
      {
            if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
                         {
                              //alert("THE SERVER RETURNED THE FOLLOWING RESPONSE:\n\n"+xmlHttp.responseText)
                              ParseResponse(xmlHttp.responseText)
                         }             
      }
What output do you see in the Javascript console?

Also, just for testing, try changing

  url = "Control/Control_Interface.php"

To:

  url = "http://www.yoursiteaddress.com/Control/Control_Interface.php"

I am sure that you are aware of this, but also note one difference between Windows and Linux/Unix platforms: filenames are case-sensitive. 'Control/Control_Interface.php' is not the same file as 'control/control_interface.php'. Make sure your file names match the case of the string in your script.

Author

Commented:
Thanks will check it out, we also found out that the server is running PHP 4, and we programmed in PHP 5. So think the problem is there as well.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial