I have looked around the web and found several tutorials on submitting a data via Ajax POST method and non of them worked. I also tried the dynamicdrive.com script. This is for a game review section on my clients site. I get no errors and I it somehow reaches readyState 4. But the script isn't being called and no response is ever returned. You can test it here http://www.roguewebdesigner.com/clients/elite-games/games/167/zelda.html . It is at the bottom of the page. Also the code I use is here http://www.roguewebdesigner.com/clients/elite-games/templates/javascript.js . The function is named "submitNewReview()". The GET method workes perfectly on my other functions. Also I know the PHP script works because I tested it without Ajax first.
Maybe this solves? function submitNewReview_stateChanged() { var allReviewsBoxHTML = document.getElementById('allReviewsBox'); if (ajax.readyState == 4 && ajax.status == 200) { // // i add innerHTML here // allReviewsBoxHTML.innerHTML = ajax.responseText; document.getElementById('submitReview_btn').style.display = "block"; } } Code (markup):
Thanks. But the main problem isn't that is is not returning a response. The problem is that the php script it it is posting to isn't being run. The PHP script works perfectly when tested without Ajax but when using Ajax it isn't running. It should add the review info to my MySQL DB and then echo the comments HTML code for the Ajax response but it isn't being run so nothing happens.