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

Ajax page not getting refreshed in IE

134 100+
hi

i have a php page in which i have included few tabs links like

games, news,entertainment etc.,

when i click the tablink an ajax page is loaded below.
In that ajax page several pages(iframes) are loaded inside the tables, such that it contains three tables in a row.
each table contains different pages loaded through iframes,
and an close button is available so that we can close the unwanted tables(containing frames).

"i hav done similar to igoogle drag and drop portion without drag option"

so if we close an table the page name is stored in the database and it is not diaplayed.,

The problem is when i close the tables(page containing iframes) its getting closed and the values are stored correctly in the database., but after that if i click the same tablink the ajaxpage gets loaded along with the closed tables(which i have closed).
i,e the page gets loaded with the old datas without getting the refreshed values from the database.,

it works well in firefox.,

Can anyone help me.,

regards
vijay
May 16 '08 #1
18 2698
acoder
16,027 Expert Mod 8TB
The page is probably getting cached.

You'll need to get a unique page, so add something like
Expand|Select|Wrap|Line Numbers
  1. "&cache="+(new Date()).getTime()
to the end of the URL.
May 16 '08 #2
vjayis
134 100+
The page is probably getting cached.

You'll need to get a unique page, so add something like
Expand|Select|Wrap|Line Numbers
  1. "&cache="+(new Date()).getTime()
to the end of the URL.

Hi

i cant understand., i m new to to ajax., where i want to add the code., and with the code do i want to do something.,?

help me to get rid of this.,
May 16 '08 #3
acoder
16,027 Expert Mod 8TB
Post your current code.
May 16 '08 #4
vjayis
134 100+
Post your current code.
Here is my code:


Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2.  
  3. function ajaxFunction1(action,id,uname,tablename)
  4. {
  5. var xmlHttp;
  6. try
  7.   {
  8.   // Firefox, Opera 8.0+, Safari
  9.   xmlHttp=new XMLHttpRequest();
  10.   }
  11. catch (e)
  12.   {
  13.   // Internet Explorer
  14.   try
  15.     {
  16.     xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  17.     }
  18.   catch (e)
  19.     {
  20.     try
  21.       {
  22.       xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  23.       }
  24.     catch (e)
  25.       {
  26.       alert("Your browser does not support AJAX!");
  27.       return false;
  28.       }
  29.     }
  30.   }
  31. xmlHttp.onreadystatechange=function()
  32.  if(xmlHttp.readyState==1)
  33.  {
  34.  
  35.  }
  36.  if(xmlHttp.readyState==4)
  37.  { 
  38.     document.getElementById("ajax1").innerHTML=xmlHttp.responseText;
  39.  }
  40. }
  41.  
  42. xmlHttp.open("GET","includes/ajaxpage.php?action="+action+"&id="+id+"&uname="+uname+"&table="+tablename,true);
  43. xmlHttp.send(null);
  44.  
  45. }
  46. </script>
  47.  
so when i close an table (containing iframe)., four variables are passed to the ajax page and the same page gets loaded without the closed table. the closed table name is stored in the database such that it is not diaplayed.,

very urgent ., help me in this.,

thanks
May 17 '08 #5
vjayis
134 100+
Post your current code.
Here is my code:


Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2.  
  3. function ajaxFunction1(action,id,uname,tablename)
  4. {
  5. var xmlHttp;
  6. try
  7.   {
  8.   // Firefox, Opera 8.0+, Safari
  9.   xmlHttp=new XMLHttpRequest();
  10.   }
  11. catch (e)
  12.   {
  13.   // Internet Explorer
  14.   try
  15.     {
  16.     xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  17.     }
  18.   catch (e)
  19.     {
  20.     try
  21.       {
  22.       xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  23.       }
  24.     catch (e)
  25.       {
  26.       alert("Your browser does not support AJAX!");
  27.       return false;
  28.       }
  29.     }
  30.   }
  31. xmlHttp.onreadystatechange=function()
  32.  if(xmlHttp.readyState==1)
  33.  {
  34.  
  35.  }
  36.  if(xmlHttp.readyState==4)
  37.  { 
  38.     document.getElementById("ajax1").innerHTML=xmlHttp.responseText;
  39.  }
  40. }
  41.  
  42. xmlHttp.open("GET","includes/ajaxpage.php?action="+action+"&id="+id+"&uname="+uname+"&table="+tablename,true);
  43. xmlHttp.send(null);
  44.  
  45. }
  46. </script>
  47.  
so when i close an table (containing iframe)., four variables are passed to the ajax page and the same page gets loaded without the closed table. The closed table name is stored in the database such that it is not diaplayed.,

very urgent ., help me in this.,

thanks
May 17 '08 #6
vjayis
134 100+
Hi

got the solution.,.

applied the code given by u correctly in the url.,

it gets working well in IE now.,

thanks
May 17 '08 #7
acoder
16,027 Expert Mod 8TB
Glad you managed to work it out yourself :)
May 17 '08 #8
vjayis
134 100+
Hi

i m with the same problem once again.,

i had added the given code by u to all the ajax url's that are contained in my page.,
but still i m having problem.,

when i select an tab(example:games) the tables which comes under the games category are displayed under the tabnames.
Note:each table contains frame in which the particular game is loaded.

if i click on another tab(example:news) before the tab(containing games) gets loaded-> mismatch occurs.,
the titles of the tables gets changed but the contents(frames) didnt get changed.,

and i had added the the code given by u to my page redirecting.,

here is my code.,

Expand|Select|Wrap|Line Numbers
  1.  
  2. var dd=(new Date()).getTime();
  3. tabs.open("GET","tabselection.php?tabname="+tab+"&data1="+data1+"&data2="+data2+"&data3="+data3+"&cache="+dd,true);
  4. tabs.send(null);
  5.  
  6.  

any other solution to get rid of this.,

regards
vijay
Jun 5 '08 #9
acoder
16,027 Expert Mod 8TB
That's a slightly different problem. You're reusing the same object which is still in use, so when you make another request whilst one is still ongoing, you need to abort the previous request. You can do that by checking that the ajax request object has not completed. If it hasn't, abort using the abort() method.
Jun 5 '08 #10
hsriat
1,654 Expert 1GB
if i click on another tab(example:news) before the tab(containing games) gets loaded-> mismatch occurs.,
the titles of the tables gets changed but the contents(frames) didnt get changed.
Apparently, you are changing the name of the tab and then sending the Ajax request. Instead, you need to run the change-name part of code in the onreadystatechange function, after you receive the xmlHttp response.
Jun 5 '08 #11
vjayis
134 100+
sorry to say this.,

i am unable to implement the ideas given by you.,

so could you explain me briefly with some coding.,

here is my full script used to load the another page while selecting another tab.,

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2.  
  3. function tabs123(tab,type,data3,data4)
  4. {
  5. try
  6.   {
  7.   tabs=new XMLHttpRequest();
  8.   }
  9. catch (e)
  10.   {
  11.   try
  12.     {
  13.     tabs=new ActiveXObject("Msxml2.XMLHTTP");
  14.     }
  15.   catch (e)
  16.     {
  17.     try
  18.       {
  19.       tabs=new ActiveXObject("Microsoft.XMLHTTP");
  20.       }
  21.     catch (e)
  22.       {
  23.       alert("Your browser does not support AJAX!");
  24.       return false;
  25.       }
  26.     }
  27.   }
  28. def5=document.getElementById("defaulthid").value;
  29. tabs.onreadystatechange=function()
  30.  if(tabs.readyState==1)
  31.  {
  32.      document.getElementById("tabimage").style.display="block";
  33.  }
  34. if(tabs.readyState==4)
  35.  { 
  36.     document.getElementById("tabimage").style.display="none";
  37.     document.getElementById("tabs").innerHTML=tabs.responseText;
  38.  }
  39. }
  40. var dd=(new Date()).getTime();
  41. tabs.open("GET","tabselection.php?tabname="+tab+"&type="+type+"&data3="+data3+"&data4="+data4+"&cache="+dd,true);
  42. tabs.send(null);
  43.  
  44. }
  45. </script>
  46.  
  47. <a style="cursor:pointer" onClick="tabs123('games','<? echo $tablename;?>','<? echo $data3;?>','<? echo $data4;?>')" >Games</a>
  48.             <a  style="cursor:pointer" onClick="tabs123('news','<? echo $tablename;?>','<? echo $data3;?>','<? echo $data4;?>')" >news</a>
  49.  
  50. <div id="tabs"></div>
  51.  
Jun 5 '08 #12
acoder
16,027 Expert Mod 8TB
There are two ways to solve this. One way is to check if the ajax object's readyState is 0 (uninitialized). If it's not, abort the request.

The second way is to just swap the open() and onreadystatechange lines, i.e. place the open() call before the onreadystatechange event handler.
Jun 5 '08 #13
vjayis
134 100+
There are two ways to solve this. One way is to check if the ajax object's readyState is 0 (uninitialized). If it's not, abort the request.

The second way is to just swap the open() and onreadystatechange lines, i.e. place the open() call before the onreadystatechange event handler.



i tried out the second way as u suggested.,

but i also like to know how to implement through first method u r saying.,
i am stuck., how to implement it.,
here i check whether the object's readystate is 0.,
Expand|Select|Wrap|Line Numbers
  1. if(xmlHttp.readyState==0)
  2. {
  3. }
  4.  
i dont know what to do within this., to abort the request.,

and if the request is aborted what will happen., the present operation will gets aborted or already running(previous) operation will get aborted??

regards
vijay
Jun 19 '08 #14
acoder
16,027 Expert Mod 8TB
i tried out the second way as u suggested.,
I assume that worked then?

but i also like to know how to implement through first method u r saying.,
i am stuck., how to implement it.,
Something like this:
Expand|Select|Wrap|Line Numbers
  1. if(xmlHttp.readyState!=0)
  2. {
  3.     xmlHttp.abort();
  4. }
  5.  
and if the request is aborted what will happen., the present operation will gets aborted or already running(previous) operation will get aborted??
There's only one Ajax object, so the previous one will get aborted to allow you to use it for the current request.
Jun 19 '08 #15
vjayis
134 100+
thanks for your guidelines given.,

and i have a another error.,

As i had told already i m having many tabs in the page which contains frames having unique datas.,

and different frames are loaded in that section by selecting the tab.,

it gets loaded.,and after selecting some tab(say second tab) and i m going to another page using a link.,

Note: this link doesnt comes inside the ajax section., it is displayed above that section.,

when i m going to next page using a link,and coming back to this previous page(i,e page containing ajax) using the back button provided by the browser., the frames are not located in to the their own sections., it gets swaped.,

so i want the user to come back to this page by using a link.,

how can i load the page without mismatch.,

do i need the disable the back button functionality of the browser or is there a way to load the datas correctly when returning back.,

regards
vijay
Jun 25 '08 #16
acoder
16,027 Expert Mod 8TB
No, don't attempt to disable the back button. You can't reliably anyway.

You can either build in history using the location hash property (there are some history frameworks out there), or use cookies. When an Ajax request is made, set a cookie. When you come back to the page, if the cookie is set, make those requests again.
Jun 25 '08 #17
vjayis
134 100+
No, don't attempt to disable the back button. You can't reliably anyway.

You can either build in history using the location hash property (there are some history frameworks out there), or use cookies. When an Ajax request is made, set a cookie. When you come back to the page, if the cookie is set, make those requests again.


Can u explain me briefly with some examples.,

coz i have not implemented nay of the way u have mentioned.,
thanks
Jun 26 '08 #18
acoder
16,027 Expert Mod 8TB
Search for ajax back button and you should find some useful links.
Jun 26 '08 #19

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

Similar topics

0
by: arunprabu | last post by:
Hi, I have a problecm with the AJAX request in my webpage. I have some filters on top of the page. I have a submit button and an empty div below the filters. Some of the filters have ajax...
9
by: =?Utf-8?B?SGFyZHkgV2FuZw==?= | last post by:
Hi all, I followed first walk through sample from http://ajax.asp.net/docs/tutorials/IntroductionUpdatePanel.aspx to create my first testing page, The problem is after I clicked that botton, it...
3
by: msinghal | last post by:
hi, I am facing one problem which is related to AJAX. I have a html page which has some links. When the page is refreshed using AJAX then if some new new link is added to the page on this refresh,...
8
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= | last post by:
I'm about to finally make the jump and start a new site using AJAX. THe question i have for all of you AJAX developers out there is which one? 1. The Standard AJAX frame work 2. The Tool kit....
2
by: kpg | last post by:
I have an AJAX enabled web service consumed by an AJAX enabled web app, given a zip code it returns the city and state. Tested the web service, it works fine. I created a services collection...
2
by: JimL | last post by:
Hi, I've been given the job of "Ajaxifying" an existing application. If I create a new test page in the application, Ajax works fine. However when I add a scriptmanager and updatepanel to an...
10
by: =?Utf-8?B?RGFuaQ==?= | last post by:
Hi, Trying to create a master page that holds a menu, and the menu switches between pages in the site. 2 problem arrosed: a. When I navigate from page to page (all AJAX Web Forms, with the...
1
by: =?Utf-8?B?TW9oc2luIEtoYW4=?= | last post by:
Hi, I am working on a website where i am creating Horizontal Menus Dynamically from database as per rights available to the user. I have several UserControls. And the Menu control also brings...
8
by: knkk | last post by:
Instead of an id getting its innerHTML changed, the entire page is getting refreshed with this function of mine (you may want to look just at the end of the function where there's an alert): ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...
0
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...
0
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,...

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.