Connecting Tech Pros Worldwide Forums | Help | Site Map

pop up window ajax

Newbie
 
Join Date: Jul 2009
Posts: 8
#1: Jul 25 '09
not sure if some one got a answer to this little issue. Im built a page that calls information from a page called database-update.asp and puts it in to the div tag Reload this. What i am trying to do is make a pop up so if some one clicks the link shown it open a pop up window. When trying to do this nothing happens. Any ideas how i can get a pop up window. I be Honest i do not understand ajax as im just using it as a refresh method to get new information every 5 seconds from a event log system im working on. Before some one points out im bypassing the users ablity to have a click noise, we had a refresh with a click and it annoyed all the programmers with it and was counter productive for other areas.

here is my code

Expand|Select|Wrap|Line Numbers
  1. <style type="text/css">
  2. <!--
  3. .style1 {font-family: Arial, Helvetica, sans-serif}
  4. body {
  5.     margin: 0px 0px 0px 0px;
  6.     background-color: #FFFFFF;
  7.     }
  8. .style3 {
  9.     color: #FF0000;
  10.     font-weight: bold;
  11.     font-family: Arial, Helvetica, sans-serif;
  12. }
  13. -->
  14. </style>
  15. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /></head>
  16. <body>
  17. <script type="text/javascript">
  18. function Ajax(){
  19. var xmlHttp;
  20.     try{    
  21.         xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari
  22.     }
  23.     catch (e){
  24.         try{
  25.             xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
  26.         }
  27.         catch (e){
  28.             try{
  29.                 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  30.             }
  31.             catch (e){
  32.                 alert("No AJAX!?");
  33.                 return false;
  34.             }
  35.         }
  36.     }
  37.  
  38. xmlHttp.onreadystatechange=function(){
  39.     if(xmlHttp.readyState==4){
  40.         document.getElementById('ReloadThis').innerHTML=xmlHttp.responseText;
  41.         setTimeout('Ajax()',10);
  42.     }
  43. }
  44. xmlHttp.open("GET","database-update.asp",true);
  45. xmlHttp.send(null);
  46. }
  47.  
  48. window.onload=function(){
  49.     setTimeout('Ajax()',100);
  50. }
  51. </script>
  52.  
  53. <div class="style1" id="ReloadThis"></div>
  54.  

gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Posts: 4,136
#2: Jul 27 '09

re: pop up window ajax


the only thing i could see is, that you don't call the service every 5s but after 100ms the first time and then 10ms later, when the response is ready. you may use the window.open() method to open a plain popup but currently you just set the innerHTML of you mentioned diff. i think i don't get the point quite well - where is a link and when do you want the popup?

kind regards
Reply

Tags
ajax, ajax pop up, pop up