473,324 Members | 2,531 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

responseText is not working in Firefox

Hi Guys,
I am using following for my code is posting data perfectly in IE & Firefox both,
but when i try to get data using responseText i return empty in firefox.
is there anyone can help me out?

Expand|Select|Wrap|Line Numbers
  1.  function createRequestObject() 
  2.      {
  3.            var xmlhttp;
  4.      try 
  5.                  { 
  6.                     xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
  7.                  }
  8.       catch(e) 
  9.                  {
  10.         try { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
  11.         catch(f) { xmlhttp=null; }
  12.         }
  13.             if(!xmlhttp&&typeof XMLHttpRequest!="undefined") 
  14.                         {
  15.              xmlhttp=new XMLHttpRequest();
  16.                }
  17.            return  xmlhttp;
  18.  }
  19. function sndRating(idnum,rateval) 
  20.   {
  21.     var dvelement = document.getElementById('dv'+idnum);
  22.     var innerHTML = "";
  23.     var results = document.getElementById('results');
  24.     dvelement.innerHTML = "<img src='progressimgred.gif'>";
  25.             try
  26.               {
  27.                 http.open('GET', 'ratingprocess.asp?id='+idnum+'&rateval='+rateval);
  28.                 http.send(null);
  29. //                http.onreadystatechange = handleResponseText;
  30.                 http.send(null);     
  31.  
  32.              }
  33.             catch(e){}
  34.             finally{
  35.                 getRating(idnum);
  36.                 }
  37.  
  38.  }
  39.  
  40. function getRating(idnum) {
  41.     var dvelement = document.getElementById('dv'+idnum);
  42.     dvelement.innerHTML = "";    
  43.     var results = document.getElementById('results');
  44.     var url = 'getRating.asp?id=' + idnum;
  45.     http.open('GET', url);
  46.     http.setRequestHeader("Content-Type", "text/xml");
  47.     http.send(null);
  48.  
  49. results.innerHTML = http.responseText;
  50. //alert(http.readyState + " " + http.status);
  51. alert(http.responseText);
  52.  }
Jul 24 '08 #1
1 2600
gits
5,390 Expert Mod 4TB
the request is async so the response isn't ready at this time where you want to process it ... you have to assign a callbackfunction to the request-object's onreadystatechange-property and handle the responseTest there ...

kind regards
Jul 24 '08 #2

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

Similar topics

3
by: e271828 | last post by:
I'm trying to access the source of an HTML page with as few alterations from the actual source (as in, that seen from the View Source option) as I can. The method...
3
by: Snt | last post by:
Hi! I am trying to get AJAX working on multiple browsers and am having a problem with Firefox. I have the following code: function handleState3(){ switch(http.readyState) { case 0: //...
5
by: furby | last post by:
I have this little bit of code : var request = false; var divid = 0; var fforie; try { request = new XMLHttpRequest(); fforie = "FF"; } catch (trymicrosoft) { try { //request = new...
1
by: abrtlt | last post by:
I have a simple PHP script that sends a string to XMLHttpRequestObject.responseText. responseText as received from the PHP script begins with 2 extra newline characters (\n\nMyString): <?php...
3
by: JMcCrillis | last post by:
I've implemented a FileUpload servlet using AJAX and JS. It appears to be working well but for one issue. I used XMLHTTP so I could intercept the response in Javascript and write it out to a field...
1
by: farghal | last post by:
Hello as many people I'm new to ajax but trying my best to understand. At this point I got a problem I'm not able to solve. I've looked on several forums and googled internet but I can't find a...
4
by: Jay10k | last post by:
Hi, I'm working with the responseText on IE but I have a problem with it I make this var test = xmlhttpobject.responseText; alert(test); there is no problem with those two lines, the...
4
RamananKalirajan
by: RamananKalirajan | last post by:
Hi All, I am using Ajax inorder to retrieve a data from the db which is an xml and i am parsing the responseText into an xml. the code what i had tried is working well with IE, but the...
4
by: aleschenko | last post by:
Hello, friends, I faced the following error and I'm at a loss what to do with it. I have PHP module in 2 files and JavaScript module. In PHP part in File1.php I put some text to ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.