woolyg Posted September 1, 2008 Share Posted September 1, 2008 Hi all, I recently re-imaged my PC and reloaded the latest Firefox (2.0.0.16), then installed 'Firebug' to check up on AJAX and JS functionality. The thing is - it appears Firefox isn't working. Using a standard AJAX call, I'm trying to populate data into a DIV (which works fine in IE6 + 7). Firebug says there's no problem, that the relevant PHP file was called OK, so it seems the JS is working OK. But the div isn't populating with the retrieved data. Has anyone else had this problem? Is there an easy fix? This was working fine on FF before, but once I reloaded FF, it stopped functioning.... Anyone? WoolyG Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted September 1, 2008 Share Posted September 1, 2008 Uhh, the latest version of Firefox is 3. I have version 3.0.1. I would consider upgrading. Quote Link to comment Share on other sites More sharing options...
woolyg Posted September 1, 2008 Author Share Posted September 1, 2008 Thanks for that. I've upgraded now - on 3.0.1, but the issue remains. Can anyone help or offer any insight? WoolyG Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted September 1, 2008 Share Posted September 1, 2008 So you've just tried to populate the div without calling any AJAX? I'd also suggest you post some code, see if there are any little bugs in it. Quote Link to comment Share on other sites More sharing options...
woolyg Posted September 1, 2008 Author Share Posted September 1, 2008 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <script language="JavaScript" type="text/JavaScript"> //XHR for AJAX Functionality function getData(dataSource, divID) { var XMLHttpRequestObject = false; if (window.XMLHttpRequest) { XMLHttpRequestObject = new XMLHttpRequest(); } else if (window.ActiveXObject) { XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHttp"); } if(XMLHttpRequestObject) { var obj = document.getElementById(divID); XMLHttpRequestObject.open("GET", dataSource, false); XMLHttpRequestObject.onreadystatechange = function() { if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) { obj.innerHTML = XMLHttpRequestObject.responseText; delete XMLHttpRequestObject; XMLHttpRequestObject = null; } } XMLHttpRequestObject.send(null); } } //Show Report data function show_report_info(job_id){ obj = document.getElementById('job_report_' + job_id); if (obj.style.display == ""){ obj.style.display = "block"; getData("reports.show_full_report.php?job_id=" + job_id, 'job_report_' + job_id); } else if(obj.style.display == "block"){ obj.style.display = 'none'; } else if(obj.style.display == "none"){ obj.style.display = 'block'; getData("reports.show_full_report.php?job_id=" + job_id, 'job_report_' + job_id); } } </script> </head> <body> <table> <tr> <td class='width_twentypercent'><font class='report_job_header'>1.</font> <a href='#' class='report_job_head' onclick=show_report_info('1')>First Job</a> </td> <td class='width_fivepercent'> </td> <td><font class='report_date'>Job Started:</font> <font class='report_date_bold'>1st Sep 2008</font> </td> <td> </td> </tr> <tr> <td colspan='4'><div id='job_report_1'></div></font> </td> </tr> </table> </body> </html> Code in reports.show_full_report.php: <?php $job_id = $_GET['job_id']; echo "<br /><br />$job_id"; ?> ..as mentioned before, it works fine in IE, and used to work fine in FF before reloading. Can you see anything that might be at fault? Thanks for your help so far. WoolyG Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted September 1, 2008 Share Posted September 1, 2008 Okay I can see one problem (maybe). The third parameter defines whether the call will by asynchronous (true) or synchronous (false). I would suggest setting it to true, instead of false. (In your open()) Quote Link to comment Share on other sites More sharing options...
woolyg Posted September 1, 2008 Author Share Posted September 1, 2008 ....that's solved it! Thank you very much, I'll need to go back & do a bit more reading on the parameters I've chosen. Solved. -WoolyG Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted September 1, 2008 Share Posted September 1, 2008 Well considering that AJAX stands for Asynchronous JavaScript and XML, I just naturally choose true. I think it actually defaults to true. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.