473,395 Members | 1,978 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,395 software developers and data experts.

[Ajax] Please wait and progress bar

Hi all, I need ur appreciated help.

This code no errors but not working because I don't see the `progressBarLong.gif` (Please Wait), but I see instantly the alert `The server script has now completed` and redirect in the server-side page where right output of the form.

Can u help me?

Expand|Select|Wrap|Line Numbers
  1.  
  2. <HTML>
  3. <HEAD>
  4. <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
  5.  
  6. <script language="javascript" type="text/javascript"> 
  7.  
  8.         var url = 'default-1.asp?rand=';
  9.  
  10.         function getHTTPObject()
  11.         {
  12.         try {
  13.         req = new XMLHttpRequest();
  14.           } catch (err1)
  15.           {
  16.           try {
  17.           req = new ActiveXObject("Msxml12.XMLHTTP");
  18.           } catch (err2)
  19.           {
  20.           try {
  21.             req = new ActiveXObject("Microsoft.XMLHTTP");
  22.             } catch (err3)
  23.             {
  24.     req = false;
  25.             }
  26.           }
  27.     }
  28.         return req;
  29.     }
  30.  
  31.         var http = getHTTPObject();      
  32.  
  33.         function handleHttpResponse() {
  34.         if (http.readyState == 4 && http.status==200) {
  35.               document.getElementById('wait').style.visibility = "hidden";
  36.               alert('The server script has now completed');
  37.            } else {
  38.               document.getElementById('wait').style.visibility = "visible";
  39.             }
  40.         }
  41.  
  42.         function longcall() {
  43.         myRand=parseInt(Math.random()*999999);
  44.         http.open("GET", url + myRand, true);
  45.         http.onreadystatechange = handleHttpResponse;
  46.         http.send(null);
  47.         }
  48.  
  49.  
  50.  
  51. function PopUp() {
  52.  
  53.    var w = 400;
  54.    var h = 400;
  55.    var l = Math.floor((screen.width-w)/2);
  56.    var t = Math.floor((screen.height-h)/2);
  57.  
  58.    finestra=window.open('mystartpage.asp','','width=' + w + ',height='+ h + ',top=' + t + ',left=' + l+',scrollbars=no,menubar=no,toolbar=no,status=no');
  59.  
  60. }
  61.  
  62. function atLeastOneChecked(form) {
  63.  
  64.    var inputs = form.getElementsByTagName('input');
  65.    var i = inputs.length;
  66.    while (i--) {   
  67.  
  68.       if(inputs[i].checked && !inputs[i].disabled)
  69.  
  70.          if(confirm("Confirm????.")) {
  71.             PopUp();             
  72.             return false;
  73.             } else {
  74.             return true; 
  75.             }          
  76.    }
  77.  
  78.    alert("ko!")
  79.    return false;
  80.  
  81. }
  82.  
  83.  
  84. </script>
  85.  
  86. </HEAD>
  87. <title>Multiple checkbox select sample</title>
  88. <BODY>
  89.  
  90.  
  91.  
  92. <form name=frmTest action="default-2.asp" method=POST onsubmit="return (atLeastOneChecked(this) && longcall());">
  93.  
  94.  
  95. <input type=CHECKBOX name=chkParent1 value="3742">karla_c26<br>
  96.  
  97. <input type=CHECKBOX name=chkParent2 value="4430">AleAlvarez<br>
  98.  
  99. <input type=CHECKBOX name=chkParent3 value="3303">Alejandra<br>
  100.  
  101. <input type=CHECKBOX name=chkParent4 value="3720">Angio<br>
  102.  
  103. <input type=CHECKBOX name=chkParent5 value="3">gino<br>
  104.  
  105. <input type=CHECKBOX name=chkParent6 value="4606">Andrea<br>
  106.  
  107. <input type=CHECKBOX name=chkParent7 value="3962">alx<br>
  108.  
  109. <input type=CHECKBOX name=chkParent8 value="4095">ANGELADAUTO<br>
  110.  
  111. <input type=CHECKBOX name=chkParent9 value="7">chinga cas<br>
  112.  
  113. <input type=CHECKBOX name=chkParent10 value="8">assim<br>
  114.  
  115.  
  116. <input type=HIDDEN name=txtCount value="10">
  117. <input type=HIDDEN name=comments value=0>
  118.  
  119. <p><input type=SUBMIT value="Select"></p>
  120. </form>
  121.  
  122. <div id="wait" style="background-color:white;position:absolute;top:240px;left:360px;width:70px;height:50px;visibility:hidden;border: 1px solid black;padding:20px;">
  123. <img src="progressBarLong.gif" style="position:relative;top:0px;left:25px">
  124. <br /><br />Please wait...
  125.  
  126. </div>
  127.  
  128. </BODY>
  129. </HTML>
  130.  
Apr 7 '11 #1
5 2576
JKing
1,206 Expert 1GB
Have you checked to ensure the path to your image is correct?
Apr 8 '11 #2
Thanks Sir, I'm sure: the image path is correct.

Try this:
http://www.avia-it.com/bytes.com/default-1.asp
Apr 8 '11 #3
NitinSawant
270 100+
have you tried re-writing all things using jquery
Apr 9 '11 #4
Thanks Sir.

No... I don't try jquery... Do u have some link to give me?
Apr 9 '11 #5
Thanks, I solved with Jquery:

index.asp
Expand|Select|Wrap|Line Numbers
  1. <html>
  2.  
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  5. <title>My page1</title>
  6.  
  7. <script type="text/javascript" src="jquery-1.5.2.min.js"></script>
  8.  
  9. <script> 
  10.  
  11. function PopUp() {
  12.  
  13.    var w = 400;
  14.    var h = 400;
  15.    var l = Math.floor((screen.width-w)/2);
  16.    var t = Math.floor((screen.height-h)/2);
  17.  
  18.    finestra=window.open('pageAdd.asp','','width=' + w + ',height='+ h + ',top=' + t + ',left=' + l+',scrollbars=no,menubar=no,toolbar=no,status=no');
  19.  
  20. }
  21.  
  22. function atLeastOneChecked(form) {
  23.  
  24.    var inputs = form.getElementsByTagName('input');
  25.    var i = inputs.length;
  26.    while (i--) {   
  27.  
  28.       if(inputs[i].checked && !inputs[i].disabled)
  29.  
  30.          if(confirm("Confirm?.")) {
  31.             PopUp();             
  32.             return false;            
  33.             } else {
  34.             return true;
  35.             }          
  36.    }
  37.  
  38.    alert("ko!")
  39.    return false;
  40.  
  41. }
  42.  
  43. function loadingAjax(div_id)
  44. {
  45.     $("#"+div_id).html('<img src="ajax-loader.gif"> saving...');
  46.     $.ajax({
  47.         type: "POST",
  48.         url: "script.asp",
  49.         data: "name=John&id=28",        
  50.         success: function(msg){
  51.             $("#"+div_id).html(msg);
  52.         }
  53.     });
  54. }
  55. </script>
  56.  
  57. <title>Multiple checkbox select sample</title>
  58. </head>
  59.  
  60. <BODY>
  61.  
  62.  
  63.  
  64. <form name=frmTest action="script.asp" method=POST onsubmit="return (atLeastOneChecked(this) && loadingAjax('myDiv'));">
  65.  
  66.  
  67. <input type=CHECKBOX name=chkParent1 value="3742">karla_c26<br>
  68.  
  69. <input type=CHECKBOX name=chkParent2 value="4430">AleAlvarez<br>
  70.  
  71. <input type=CHECKBOX name=chkParent3 value="3303">Alejandra<br>
  72.  
  73. <input type=CHECKBOX name=chkParent4 value="3720">Angio<br>
  74.  
  75. <input type=CHECKBOX name=chkParent5 value="3">gino<br>
  76.  
  77. <input type=CHECKBOX name=chkParent6 value="4606">Andrea<br>
  78.  
  79. <input type=CHECKBOX name=chkParent7 value="3962">alx<br>
  80.  
  81. <input type=CHECKBOX name=chkParent8 value="4095">ANGELADAUTO<br>
  82.  
  83. <input type=CHECKBOX name=chkParent9 value="7">chinga cas<br>
  84.  
  85. <input type=CHECKBOX name=chkParent10 value="8">assim<br>
  86.  
  87.  
  88. <input type=HIDDEN name=txtCount value="10">
  89. <input type=HIDDEN name=comment value=0>
  90.  
  91. <p><input type=SUBMIT value="Select"></p>
  92.  
  93. </form>
  94.  
  95.  
  96. <div id="myDiv"></div>
  97.  
  98. </body>
  99.  
  100. </html>
script.asp
Expand|Select|Wrap|Line Numbers
  1. <%@ Language=VBScript %>
  2.  
  3. <%
  4.  
  5.   Function Sleep(sec)
  6.      Dim Start:Start = Timer:While (Timer-Start<sec):Wend
  7.   End function   
  8.  
  9.   Sleep 5
  10.  
  11. %> 
  12.  
  13. <HTML>
  14. <HEAD>
  15. <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
  16. <title>Checkbox selection</title>
  17. </HEAD>
  18. <BODY>
  19.  
  20. <%
  21. iCount = Request("txtCount")
  22.  
  23. response.write Request("commento") & "<br><br>"
  24.  
  25. if Request("comment") > "0" then
  26.    strComment = Split(Request("comment"), "-")
  27.    response.write strComment(0) & "<br>" &_
  28.                   strComment(1) & "<br>" 
  29. end if   
  30.  
  31. %>
  32. <p>
  33. There were <%=iCount%> checkboxes
  34. </p>
  35. <p>
  36. <%
  37. for i = 1 to iCount
  38.     sID = Request("chkParent" & i)
  39.     if sID = "" then
  40.         Response.Write "Item " & i & " was NOT checked<br>"
  41.     else
  42.         Response.Write "Item " & i & " was checked, it's ID is " & sID & "<br>"
  43.     end if
  44. next
  45. %>
  46. </p>
  47. </BODY>
  48. </HTML>
pageAdd.asp
Expand|Select|Wrap|Line Numbers
  1. <html>
  2.  
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  5. <title>Nuova pagina 1</title>
  6.  
  7. <script language="javascript" type="text/javascript">
  8. <!--
  9.  
  10. function insertf1(f1) {
  11.  
  12.       var re = /[^a-zA-Z0-9\''\,\.\;\:\ ]/g,             
  13.       result = re.exec(Qform.TextareaS1.value);
  14.  
  15. for ( var n = 0 ; n < Qform.elements.length ; n++ ) {
  16.       var field = Qform.elements[n];
  17.  
  18.       if (field.value.length <= 0) {
  19.           window.alert('KO');
  20.           field.focus();
  21.           field.select();   
  22.           return;            
  23.         }
  24.     }
  25.  
  26.       if (!Qform.TextareaS1.value.match("^[a-zA-Z0-9\.;,:' ]{1,100}$")) {
  27.           window.alert(' + ( result.index + 1 ) + ' "' + result + '".');
  28.           Qform.TextareaS1.focus();
  29.           Qform.TextareaS1.select();
  30.           return;
  31.     }
  32.  
  33.       else {   
  34.  
  35.           window.opener.document.frmTest.comment.value=f1;
  36.           window.alert("OK."); 
  37.           window.opener.document.frmTest.submit();
  38.           setTimeout("self.close()",300);
  39.           window.opener.loadingAjax('myDiv');
  40.  
  41.     }  
  42. }
  43.  
  44. //-->
  45. </script>
  46.  
  47. </head>
  48.  
  49. <body>
  50.  
  51. <form name="Qform">
  52.     <p>Data scadenza<input type="text" name="DataT1" size="20"></p>
  53.     <p>Commento<textarea rows="10" name="TextareaS1" cols="40"></textarea></p>
  54.     <p><a href="javascript:insertf1(document.Qform.DataT1.value+'-'+document.Qform.TextareaS1.value);">
  55.     <img border="0" src="get_ff.png" width="84" height="16"></a></p>
  56. </form>
  57.  
  58. </body>
  59. </html>
Apr 11 '11 #6

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

Similar topics

3
by: Kannan | last post by:
Hello, I have a requirement that specifies that I display a "Please Wait..." window (preferably modal) along with a gif that mimics a progress bar during a save operation. The dialog needs to be...
1
by: metsymani | last post by:
In my web application, I have a search screen coded in ASP.Net. The Search process takes lot of time. So, I need to show a wait page informing the user that "Search is in progress. Please wait" along...
5
by: Erwin Kloibhofer | last post by:
what if i have a webpage that displays the text "please wait, this may take a few seconds..." and it now waits until some event on the server happens. whatever this is, this can be quick, but it...
2
by: Matt Culbreth | last post by:
Hello, I've got a fairly typical request to show a "Plese Wait" page while a long process is running. In this case, the user fills out a form, presses the button, a process searches for items,...
7
by: mw | last post by:
I'm writing an application that's going to do alot of processing while the user is waiting, (imagine sitting and waiting while the server/background processing is occurring). What's the best way...
6
by: Jeremy Chapman | last post by:
I have a button on my page which when clicked redirects to another page. on the page load of the page that I've redirected to, there is a long query. What I want to do is with dhtml, display test...
11
by: C10B | last post by:
hi all, I have 3 drop down lists. When any of them changes there is an auto postback to do some server stuff. It is not always obvious (as a user) that a page reload has been started, and you...
5
by: MattC | last post by:
Hi, I have a webservice that returns a byte for an image. I'd like to disaplay an image while the webservice is being contacted and then once the byte is available show that and remove the...
5
by: Jeremy | last post by:
Hi all, I have database actions that will potentially take several seconds to complete. My normal page uses AJAX so keeping the user informed of what is happening is not a problem. ...
5
AaronL
by: AaronL | last post by:
Hello, I wrote a program that uploads images to a website using PHP but I'm not liking how it's currently working. When the user hits submit, the browser takes a long time, which I know is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.