Dec 16, 2013 02:29 PM
(This post was last modified: Dec 16, 2013 02:38 PM by Cathal.)
I'm trying to query a database via ajax with javascript, but it simply won't work!
I tried running the send.php script manually and the database updated fine, so that script is not the problem. Furthermore, when I load the broken script and check the javascript console, there's no errors;
However, notice how there's no request for send.php? It's just not sending, and I can't figure out why.
Furthermore, the request.php ran successfully, and I'm using (word for word) the exact same code to make that request, the only difference being the actual URL, obviously.
Finally, I set up flags at various points throughout the script, all of which executed without fault. Dafuuuq?
EDIT, nothing in the apache logs either.
PHP Code
<?php
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function()
{
if(xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
document.getElementById("sb").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "send.php?name=cathal&message=test", true);
xmlhttp.send();
I tried running the send.php script manually and the database updated fine, so that script is not the problem. Furthermore, when I load the broken script and check the javascript console, there's no errors;
Code
[21:14:36.202] POST http://localhost/xxxx/xxxx/ [HTTP/1.1 200 OK 11ms]
[21:14:36.294] GET http://localhost/xxxx/xxxx/refresh.php [HTTP/1.1 200 OK 11ms]However, notice how there's no request for send.php? It's just not sending, and I can't figure out why.
Furthermore, the request.php ran successfully, and I'm using (word for word) the exact same code to make that request, the only difference being the actual URL, obviously.
Finally, I set up flags at various points throughout the script, all of which executed without fault. Dafuuuq?
EDIT, nothing in the apache logs either.

