473,320 Members | 2,083 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,320 software developers and data experts.

Ajax Issue with IE

133 100+
Hi,

I am running the following code on my website:

Expand|Select|Wrap|Line Numbers
  1. function showHint2(str)
  2. {
  3. if (str.length==0)
  4.   { 
  5.   document.getElementById("txtHint").innerHTML="";
  6.   return;
  7.   }
  8. if (window.XMLHttpRequest)
  9.   {// code for IE7+, Firefox, Chrome, Opera, Safari
  10.   xmlhttp=new XMLHttpRequest();
  11.   }
  12. else
  13.   {// code for IE6, IE5
  14.   xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  15.   }
  16. xmlhttp.onreadystatechange=function()
  17.   {
  18.   if (xmlhttp.readyState==4 && xmlhttp.status==200)
  19.     {
  20.     document.getElementById('course').innerHTML = xmlhttp.responseText;
  21.     }
  22.   }
  23.  
  24.   var params = [];
  25.  
  26. params.push("q=" + str);
  27. params.push("u=" + document.getElementById("university").value);
  28. params.push("w=" + document.getElementById("university2").value);
  29.  
  30. var url = "update-course.php?" + params.join("&");
  31.  
  32.   infoStr = str+"&u="+document.getElementById('university').value+"&w="+document.getElementById('university2').value;
  33. xmlhttp.open("GET",url,true);
  34. xmlhttp.send();
  35. }
  36.  
Expand|Select|Wrap|Line Numbers
  1. require_once('init.php');
  2.  
  3.     //get the q parameter from URL
  4.     $choice=$_GET["q"];
  5.     $uni=$_GET["u"];
  6.     $uni2=$_GET["w"];
  7.  
  8.     if ($choice == 'Postgraduate'){
  9.         $year_of_study = "Postgraduate";
  10.     }else{
  11.         $year_of_study = "Undergraduate";
  12.     }
  13.  
  14.     if ($uni2 == '-1'){ 
  15.     $query = mysql_query("SELECT * FROM universities WHERE year_of_study = '$year_of_study' AND university = '$uni'");
  16.     }else{
  17.     $query = mysql_query("SELECT * FROM universities WHERE year_of_study = '$year_of_study' AND university = '$uni2'"); 
  18.     }
  19.     while ($row = mysql_fetch_array($query))
  20.             {
  21.              print "<option value='" . $row['course'] . "'>" . $row['course'] . "</option>";
  22.             }
  23.  
The code is designed to load results into a select box once the user has selected an option from a previous select box. E.g. someone selects Ford and all the options in the database under the make ford loads.

Which works fine on all browsers except IE. Does anyone have any ideas why this would not work on IE?

Cheers,
Adam
Mar 16 '11 #1
2 1380
NitinSawant
270 100+
use jquery to make ajax calls

http://api.jquery.com/jQuery.ajax/
Mar 16 '11 #2
acoder
16,027 Expert Mod 8TB
This seems to be a caching issue. Add a unique timestamp to the URL request.
Mar 16 '11 #3

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

Similar topics

12
by: whreed | last post by:
I am using AJAX XMLhttprequest to request another page on form submit and I am loading that page into a span tag. My issue is that I have more js in the called page that loads a calendar on click...
6
by: Nico VanHaaster | last post by:
Hello all, I have run across an issue with IE 6.0+. I have a page that makes an XMLHttpRequest to the webserver to update a report on the page. The first time you hit the refresh report button...
1
by: | last post by:
Hi all, I have an ascx UC that contains an update panel. When a button inside this update panel is clicked, a partial page postback occurs, I do some processing on the server side, and then I am...
1
by: | last post by:
Hi all, I have an interesting issue that I think maybe related to AJAX. Here is my scenario:- I have an aspx page that contains an UpdatePanel with UpdateMode="conditional". There exists 2...
0
by: David C | last post by:
I have posted my issue in detail on the asp.net forum. Here is the URL: http://forums.asp.net/t/1174693.aspx You will see there my sample ASP.NET code. It is as simple as it can get. ...
0
by: | last post by:
Hi all, I am having an interesting issue with nested usercontrols with the following scenario: Web Project 1 UserControl1 - contains various form controls inside an UpdatePanel UserControl2...
1
by: kriszd91 | last post by:
hi, i'm having an ajax/xml problem. function loadpage(page) { if(xmlHttp==null) { alert('Could not create XMLHttpRequest object or ActiveX equivalents!'); return; }...
4
by: Arnab das | last post by:
My ajax enabled website is fine in my development machine when it is run from vs 2005.When I publisg the project and upload that in server I am getting an Java Script error- 'AjaxControlToolkit'...
3
by: ziycon | last post by:
I'm having an issue with my AJAX function, its been working fine then I added another link, and now when i click on an AJAX link on the menu, it tries to load the correct page for a split second and...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.