Jump to content

[SOLVED] Javascript not working properly in Firefox?


woolyg

Recommended Posts

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

Link to comment
Share on other sites

<!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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.