Ok so I have my HTML file's body (the script file is loading according to firebug).
<BODY onload='load_list(1)'> <CENTER> <div id='list_container'> MySQL List Displayed using AJAX <div id='list'> Page 1 </div> Add an Item </div> </CENTER> </BODY>When it loads its meant to run the "load_list" function passing the variable "1".
Next I have my script.js file (firebug shows this being loaded)
var request;
function load_list(page) {
if (window.XMLHttpRequest()) {
request = new XMLHttpRequest();
} else {
request = new ActiveXObject("Microsoft.XMLHTTP");
}
request.xmlreadystatechange=function() {
if (request.readyState==4 && request.status==200) {
document.getElementByID("list").innerHTML=request.responseText;
}
}
request.open("GET","getList.php" + page,true);
request.send;
}
Finally I have my PHP file getList.php, it seems to be working fine but I'll post the HTML code it generates anyway:<table width='550px'> <tr> <td> 1 </td> <td> Bob </td> <td> Bob </td> <td> 2011-05-14 11:14:50 </td> </tr> <tr> <td> 2 </td> <td> Jem </td> <td> Bob </td> <td> 2011-05-14 11:14:50 </td> </tr> </table>Please DO NOT FLAME ME!
I understand some people will just swim through my text only noticing that my PHP code is HTML output. As the PHP code is working fine I decided not to post it!
Well basically that does absolutely nothing, if I put in a alert message in the load_list function it works through.
After a while I downloaded firebug, here is the output (css.css is my CSS file).
Quote
[13:56:10.815] GET http://localhost/tes..._list/script.js [HTTP/1.1 304 Not Modified 4ms]
[13:56:10.798] GET http://localhost/tes...ax_list/css.css [HTTP/1.1 304 Not Modified 3ms]
[13:56:10.723] GET http://localhost/test/ajax_list/ [HTTP/1.1 200 OK 5ms]
[13:56:10.798] GET http://localhost/tes...ax_list/css.css [HTTP/1.1 304 Not Modified 3ms]
[13:56:10.723] GET http://localhost/test/ajax_list/ [HTTP/1.1 200 OK 5ms]


Sign In
Create Account


Back to top









