473,725 Members | 2,070 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AJAX Script not working in IE

3 New Member
I am running a code that works just fine in Firefox, but seems to have trouble in IE. The basic idea is that a travel search process is initiated with one ajax call, and a 2nd ajax call 'updates' the page with the results that have been retrieved thus far. This 2nd call loops until the first call (the search) is complete.

Everything works fine in Firefox, but in IE, the 2nd call doesn't work until the very end when the 1st call is complete. In other words, in IE, you don't see the results being continuously updated -- you just see the final set of results at the end.

Now, the search (i.e. the first AJAX call) does use the cURL library with php, which may have something to do with it. I thought it may be the 'two simultaneous connection' thing, but why would it work in Firefox without any problem??

Here is JS I'm using...

Expand|Select|Wrap|Line Numbers
  1.  
  2. function startSearch(sess, inmonth, inday, inyear, outmonth, outday, outyear, sort, loc1, loc2, loc3, loc4, loc5, starslm, stars, minp, maxp, exp)
  3. {
  4.     var loadingtext    = '<img src=/images/loader.gif><br>Please wait while we process your search...<br>Searches may take up to a minute.'; 
  5.     document.getElementById("loading").innerHTML=loadingtext;
  6.     repeatSort = 1;
  7.  
  8.         var url="dosearch.php";
  9.         url=url+"?sess="+sess;
  10.         url=url+"&inmonth="+inmonth;
  11.         url=url+"&inday="+inday;
  12.         url=url+"&inyear="+inyear;
  13.         url=url+"&outmonth="+outmonth;
  14.         url=url+"&outday="+outday;
  15.         url=url+"&outyear="+outyear;
  16.         url=url+"&sid="+Math.random();
  17.  
  18.         searchRequest=GetXmlHttpObject();
  19.         searchRequest.onreadystatechange=function(){
  20.             searchReqChanged();
  21.         }
  22.         searchRequest.open("GET",url,true);
  23.         searchRequest.send(null);
  24.     getSorter(sess, sort, loc1, loc2, loc3, loc4, loc5, starslm, stars, minp, maxp);
  25. }
  26.  
  27. function searchReqChanged(){
  28.     if (searchRequest.readyState==4)
  29.     {     
  30.         repeatSort = 0;
  31.     }
  32. }
  33.  
  34.  
  35. function getSorter(sess, sort, loc1, loc2, loc3, loc4, loc5, starslm, stars, minp, maxp)
  36. {
  37.         var sesst= escape(encodeURI(sess));
  38.         var url="sorter2.php";
  39.         url=url+"?sid="+Math.random();
  40.         url=url+"&sesst="+sesst+"&sort="+sort+"&loc1="+loc1+"&loc2="+loc2+ "&loc3="+loc3+"&loc4="+loc4+"&loc5="+loc5+"&starslm="+starslm+ "&stars="+stars+"&minp="+minp+"&maxp="+maxp;
  41.         sorterRequest=GetXmlHttpObject();
  42.  
  43.         sorterRequest.onreadystatechange=function(){
  44.  
  45.             sorterReqChanged(sess, sort, loc1, loc2, loc3, loc4, loc5, starslm, stars, minp, maxp);
  46.         }
  47.  
  48.         sorterRequest.open("GET",url,true);
  49.         sorterRequest.send(null);
  50. }
  51.  
  52.  
  53. function sorterReqChanged(sess, sort, loc1, loc2, loc3, loc4, loc5, starslm, stars, minp, maxp){
  54.     if (sorterRequest.readyState==4)
  55.     { 
  56.         document.getElementById("results").innerHTML=sorterRequest.responseText;
  57.  
  58.         if (repeatSort != -1){
  59.             getSorter(sess, sort, loc1, loc2, loc3, loc4, loc5, starslm, stars, minp, maxp);
  60.  
  61.         }
  62.         if (repeatSort == -1){
  63.             var finished = 'Search Complete!';
  64.             document.getElementById("loading").innerHTML=finished;    
  65.         }
  66.         if (repeatSort == 0){
  67.             repeatSort = -1;
  68.         }
  69.     }
  70.  
  71. }
  72.  
  73. function GetXmlHttpObject()
  74. {
  75. var xmlHttp=null;
  76. try
  77.   {
  78.   // Firefox, Opera 8.0+, Safari
  79.   xmlHttp=new XMLHttpRequest();
  80.   }
  81. catch (e)
  82.   {
  83.   // Internet Explorer
  84.   try
  85.     {
  86.     xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  87.     }
  88.   catch (e)
  89.     {
  90.     xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  91.     }
  92.   }
  93. return xmlHttp;
  94. }
  95.  
  96.  
Jan 14 '08 #1
1 2078
kunal pawar
297 Contributor
May be IE readystate will be "complete" rather than 4

Expand|Select|Wrap|Line Numbers
  1. function searchReqChanged(){
  2.     if (searchRequest.readyState==4 || searchRequest.readyState=="complete")
  3.     {   
  4.         repeatSort = 0;
  5.     }
  6. }
Jan 15 '08 #2

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

Similar topics

21
6150
by: javainfo | last post by:
How can i refresh IFRAME and load data through AJAX?
4
7472
by: evgenyg | last post by:
Hello ! We have the following situation - when Ajax request is sent what's being returned by the server is usually an XML (which is used for DOM updates) but sometimes it's HTML which is a whole new page that should replace an existing one. I.e when we issue an Ajax request we don't know what will be returned and analyze the response to act accordingly. Now, the way to replace the current document with a new one used to be easy and...
3
2990
by: noballack | last post by:
I've got a problem, I'm working with Ajax in a web with a form with a list of checkbox added to the form via an Ajax.Updater method. These added checkboxs are not been sended by the form if I use Firefox or Safari. My source code is something like that: <script type="text/javascript" src="http://www.my_web_page.com//js/prototype-1.4.0.js"></script> <script> function showMoreOptions( url, pars, div_id ){ if...
25
2795
by: meltedown | last post by:
This is supposed ot be an example: http://www.ajaxtutorial.net/index.php/2006/11/30/simple-ajax-using-prototype-part-2/ It says : This example is probably the simplest example you will ever find. We are going to use the prototype feature ‘ajax.Updater’ (see part one for more details on prototype).
1
4032
by: geevaa | last post by:
http://www.phpbuilder.com/columns/kassemi20050606.php3 XMLHttpRequest and AJAX for PHP programmers James Kassemi Introduction: Although the concept isn't entirely new, XMLHttpRequest technology is implemented on more sites now than ever. Compatibility is no longer an issue (IE, Mozilla and Opera all support it), and the benefits to using it are amazing. There are too many PHP programmers avoiding any
6
5165
by: =?Utf-8?B?U2hhd24gU2VzbmE=?= | last post by:
Greetings! I was researching AJAX to provide a solution to displaying status messages while a long process executed. I found several examples online and was able to use their code to get a quick application working. However, when attempting to implement the solution, the AJAX calls weren't updating the screen like the examples were and seemed not to fire until after the long running process had completed. I found the only real...
2
3171
by: shivendravikramsingh | last post by:
hi friends, i m using a ajax function for retrieving some values from a database table,and display the values in required field,my prob is that the ajax function i m using is working f9 once,but if i change something in php file using in ajax function.it not refreshed,means its shows the previous result it not get updated.i can't understand whats the prob.this is the code i m using: <? include("config.inc.php"); //error_reporting(0); ...
1
2053
by: Mark B | last post by:
This is my first try at using AJAX. I want the calendars to be enabled if the user checks CheckBox1. It works OK for a normal all page refresh but once I introduced the AJAX code it stopped working. Any ideas? <%@ Page Language="VB" AutoEventWireup="false" CodeFile="default-ajax.aspx.vb" Inherits="pages_verify_groups_Default" Debug="true" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
2523
RamananKalirajan
by: RamananKalirajan | last post by:
Hi those who were working in Ajax, will surely experienced with this problem. SOP - Single Origin Policy problem. I am doing a small work in Prototype Ajax. I did a sample work. When I am passing the URL to the Ajax call within the same directory. It is showing an exception "Access Denied". The cause for this exception is SOP. This occur only with the IE. Had anyone overcome this problem. If so means pls tell me that would be very helpful for...
1
4609
by: javediq143 | last post by:
Hi All, This is my first post in this forum. I'm developing a CMS for my latest website. This CMS is also in PhP & MySQL. I'm done with the ADD section where the Admin can INSERT new records in Database but I'm stuck in the EDIT. I'm getting 2 problems over here. Below is the description: 1)The FIRST page will list all the records from the table which Admin can EDIT with CHECKBOX for each record to select. He can select one or more than one...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9257
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
9176
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
9113
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...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
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
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3221
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
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.