File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Problems sending and receiving with XMLHttpRequest Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Problems sending and receiving with XMLHttpRequest " Watch "Problems sending and receiving with XMLHttpRequest " New topic
Author

Problems sending and receiving with XMLHttpRequest

G Moore
Greenhorn

Joined: Jun 12, 2011
Posts: 1
Hi all,

I'm having some problems both sending information to the backend (PHP) using POST, as well as successfully getting a response (if and when sending works).

I should preface everything by specifying that I'm working entirely in a local environment (using MAMP), which my research thus far indicates could be a contributing factor (?). Should also mention, along those lines, that I've modified my response script to accept status 0 as well as 200 (the former being an acceptable response when running in a local environment).

I've gotten to the point where I get the appropriate readyState and status responses, but there are issues in actually communicating with the PHP it seems.

First of all, here are my JS functions:



Instead of the "validate_user.php" destination indicated above, I first tried a simpler "hello_ajax.php" test:



With this, I was able to check that entries were successfully added to the "test" table. Also, the "pass" value being passed in was correct (from my html form that calls the ajax).

However, the echo'd message was not successfully received back in the "checkResponse" JS function - the alert was simply "Server says: " with no response text. That illustrated the receiving problem.

Now, consider "validate_user.php" instead of the hello_ajax function before:



With this, the database query at the start of the function is simply so I can check that we make it to that point - but we don't. In this case, it seems like we're not even getting into the PHP. I tried comparing this with the hello_ajax example but can't see any differences that would lead to this apparent breakdown in communication.

If anyone could help me out with any or all of these issues, I would appreciate it immensely!
 
wood burning stoves
 
subject: Problems sending and receiving with XMLHttpRequest
 
Similar Threads
IE 6 problem with Dates?
AJAX+STRUTS
Javascript and PHP
AJAX: posting a ampersand?
xmlhttprequest is not sending any request to the servlet