473,657 Members | 2,654 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Whats wrong with this AJAX Code? Not working in FireFox

20 New Member
Hi,
I m confused about following ajax code. Where is the problem? Working good on IE but not on FireFox?

Please sort it out.

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function loadXMLDoc()
  3. {
  4. if (window.XMLHttpRequest)
  5.   {// code for IE7+, Firefox, Chrome, Opera, Safari
  6.   xmlhttp=new XMLHttpRequest();
  7.   }
  8. else
  9.   {// code for IE6, IE5
  10.   xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  11.   }
  12. xmlhttp.onreadystatechange=function()
  13.   {
  14.   if (xmlhttp.readyState==4 && xmlhttp.status==200)
  15.     {
  16.     document.getElementById("myDiv").innerHTML="hello";
  17.     }
  18.   }
  19. xmlhttp.open("GET","index.aspx?id=abc",true);
  20. xmlhttp.send();
  21. }
  22. </script>
Thanx in advance.
Jun 30 '10 #1
1 1816
gits
5,390 Recognized Expert Moderator Expert
first try an alert before setting the innerHTML ... to see whether the callback is called correctly ... next check whether document.getEle mentById("myDiv ") returns you the correct node ... you might consider installing the firebug extension to FF where you instantly should see any errors

kind regards
Jul 1 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
3288
by: Tamar Solutions | last post by:
ManagementObject mo = new ManagementObject(".NET CLR MEMORY"); thanks - JJ
1
1337
by: Steve1 via DotNetMonster.com | last post by:
Hi all, Why is the last line of this code snippit pulling up with an error? Any help will be appreciated - Thanks, Steve. string str_SQLLayoutsPound = "SELECT * FROM Layouts ORDER BY Name"; OleDbCommand obj_SQLLayoutsPound = new OleDbCommand( str_SQLLayoutsPound, obj_SourceConn ); OleDbDataReader obj_ReaderLayoutsPound = obj_SQLLayoutsPound.ExecuteReader(); while( obj_ReaderLayoutsPound.Read())
2
1178
by: JR | last post by:
hi, The next code gives me no records back. if I do the same selection with acces I have many records, depending on the param LiedNaam Thanks Jan sConnectionString ==> standaard connection string but public dimd '-------------------------code starts here-------------------------------------------------------------------
9
3902
by: anuj_05 | last post by:
i am trying to change color on mouse over in linkbutton the code gives error javascript:_doPostback(Sideheader1$linkButton8). I am writing code in user control with .ascx extension. my code is <script type="text/javascript"> LinkButton8.Attributes.Add("onmouseover","window.status='';this.style.color='Red'; return true"); LinkButton8.Attributes.Add("onmouseout","window.status='';this.style.color='Navy'; return true"); </script>...
3
3285
by: nahiyan13 | last post by:
hey there I have been given a problem where i have to write a function integerPower(base,exponent)that returns the value base^exponent(in words meaning if base is 2 and exponent is 3 then the program has to provide 2 to the power 3 which is 8 as an output)Our teacher asked to use a for loop to do this and by noother means.I have written the source code and the program runs but its giving me the wrong answers.Could sum 1 plz sort this out?Thanks...
5
2314
by: islayer | last post by:
can someone tell me what is wrong with the bold code? i am just learning perl. the program should create a perl file with a random name (5 letters, followed by a number), but the name is always just the number. whats wrong with my code? #!/usr/bin/perl use Fcntl; @array = (a..z); srand; foreach (1..5) { $name = int(rand scalar(@array));
11
1455
thatos
by: thatos | last post by:
The code is below import java.io.*; class Storage{ int num = 0; String name = null; } public class gift1 { public static void main(String args) throws IOException{
7
1527
lifeisgreat20009
by: lifeisgreat20009 | last post by:
(This is not a trick question, there is a potential real problem in using this code) class Singleton{ public static Singleton Instance() { if (_instance == null) _instance = new Singleton(); return _instance; } protected Singleton() {} private static Singleton _instance = null;
6
2393
by: angelicdevil | last post by:
how can i get the php to read the all the file names within a folder and put the names into an array?
0
8394
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7327
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.