473,671 Members | 2,373 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript popup window question

31 New Member
All,

I am using javascript (window.open()) to create a popup to do some processing. This popup is going to create a PDF which can take anywhere from 10 secs to 2 mins (alot of backend SQL calls) and I was hoping to use this popup to show the user that something is going on (animated gif) and give them the ability to use the parent window to do other things in our system (while the popup is creating the PDF on the server).

My problem lies in the fact that while the popup is creating the PDF, the parent window cannot navigate to other pages (until the popup window is done). Is there any way to disassociate the popup window with the parent window so a user will be able to navigate with the parent window while the popup window is processing?

Thx
jonpfl
Jul 17 '08 #1
18 2335
gits
5,390 Recognized Expert Moderator Expert
you could send an AJAX-call and just open the window when the server sends the response ... this is done in the onreadystatecha nge-callback - first just have a look at a basic AJAX-example and ask more questions about it when you have them :)

kind regards
Jul 17 '08 #2
jonpfl
31 New Member
I have never used ajax before.

Is there a way to do with just javascript or am I going to have to get ajax?

Thx
jonpfl
Jul 17 '08 #3
gits
5,390 Recognized Expert Moderator Expert
AJAX is just javascript ;) ... by making use of the browsers XMLHttpRequest and its asynchronous behaviour ... with that you could achieve what you want ...

kind regards
Jul 17 '08 #4
jonpfl
31 New Member
AJAX is just javascript ;) ... by making use of the browsers XMLHttpRequest and its asynchronous behaviour ... with that you could achieve what you want ...

kind regards
Ok, let me get this straight.

If I incorporate Ajax on my child/popup to create the PDF, my user is going to be able to go to the parent window and navigate to another page while the child/popup is awaiting a response from the server?

Sorry if this is a total newbie question but I am new at this.

Thx
jonpfl
Jul 17 '08 #5
gits
5,390 Recognized Expert Moderator Expert
not exactly ... basicly you start a async XMLHttpRequest and say: open the window when you are ready ... the user may do whatever he wants in the meantime ...
Jul 17 '08 #6
jonpfl
31 New Member
not exactly ... basicly you start a async XMLHttpRequest and say: open the window when you are ready ... the user may do whatever he wants in the meantime ...
Now that you tell me this, I think I might want to do it another way (tell me which ones are feasible)

1) User is on page1.asp and clicks a button to create a PDF. I use javascript to send an async call to the server to start creating the PDF (it is all vbscript with a bunch of stored procs). While the PDF is being created, I assume the user can navigate to page2.asp and do something else, correct? I was thinking that instead of using a popup window when completed, I could just email them the PDF using vbscript on the server. Does this sound doable? I assume I do not actually have to have a callback function, right?

2) If I decide to use a popup window and user makes the request on page1.asp and has now changed to page2.asp, how would I handle that? I assume every possible page the user could navigate to in our internal app, I would have to have that callback function declared in the javascript, right? We currently have an include file called common.asp that I could it in since all our pages include that.

Is there a specific version of Ajax you recommend for ASP? Right now, I am reading up on one called "Sarissa"

Thx
jonpfl
Jul 17 '08 #7
gits
5,390 Recognized Expert Moderator Expert
i think your first version sounds quite good ... but to clarify something: the callbackfunctio n is passed to the requestobject itself ... it mustn't be declared on every page ... and there is nothing like an ajax-version or something similar ... it is just javascript and xml and an instance of the XMLHttpRequest-Object of a browser ... there are just some frameworks out there that encapsulate the usage of all of this ...
Jul 17 '08 #8
jonpfl
31 New Member
i think your first version sounds quite good ... but to clarify something: the callbackfunctio n is passed to the requestobject itself ... it mustn't be declared on every page ... and there is nothing like an ajax-version or something similar ... it is just javascript and xml and an instance of the XMLHttpRequest-Object of a browser ... there are just some frameworks out there that encapsulate the usage of all of this ...
Ok, I put some ajax in my javascript code

Expand|Select|Wrap|Line Numbers
  1.             http_request = new XMLHttpRequest();
  2.             sURL = "ReportHeading=" + frmCreditReport.ReportHeading.value;
  3.             sURL += "&MeetingId=" + frmCreditReport.MeetingId.value;
  4.             http_request.onreadystatechange = jon;
  5.             http_request.open('POST', "popup_pdf.asp?" + sURL, true);
  6.             http_request.send(null);
  7.  
  8. function jon()
  9. {
  10.     if (http_request.readyState == 4)
  11.     { 
  12.         alert(http_request.responseText);
  13.     } 
  14. }
  15.  
And I can see that the PDF is getting created (I save it to a temp directory) but I still have the problem of not being able to navigate to another page. When I try to change to another page, my page waits until the Ajax is complete before continuing.

What am I doing wrong?

Thx
jonpfl
Jul 17 '08 #9
gits
5,390 Recognized Expert Moderator Expert
is it a large pdf? ... what if you just alert a string like 'foo'? may be the problem is the transfer of the response data and not the pdf-creation at all? presenting a download-link or send it per mail as you already suggested would workaround that?
Jul 17 '08 #10

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

Similar topics

2
2095
by: Jeannie | last post by:
I have a popup window which is a slideshow of about 7 images. When the popup window loads, the first image is present and then the viewer can select next or previous to scroll through the rest of the images. I'd like to use the same popup window at different points throughout the website and have the Virtual Tour (slideshow) open up at the appropriate photos. Meaning I'd like to control which picture the popup window opens up to,...
5
2199
by: Lucian Sandor | last post by:
Hello everyone, While I'm a newbie here, I a not new to google, so please don't send me back, it would be useless. First of all I have to specify I am working on a Blogger.com template, therefore anything I'll write should be stuck on a single file. I thought about creating a funny pop-up. <a href="javascript:myFunction();"... that's because, as you will see, the code for the popup is pretty complex. I've insterted myFunction somewhere...
4
1512
by: Randell D. | last post by:
Folks, I have a javascript function which is a popup - It contains a list in form tags - When the user selects a value in the popup, and clicks submit, I want the values to be transfered to the parent opening window. I have managed this when I know the name of the parent window - however there are two or three different 'parent' forms with different form names that could reference this popup session meaning my current solution only...
9
2875
by: Robby Bankston | last post by:
I'm working on some code and am running into brick walls. I'm trying to write out Javascript with Javascript and I've read the clj Meta FAQ and didn't see the answer, read many similar posts (with no luck though), and searched through the IRT.ORG Faqs (www.irt.org/script/script.htm). The Javascript is designed to open an popup window and then inside that window call another script which will resize that window. There may be another...
12
1914
by: Mark Fox | last post by:
Hello, I am attempting to do something very simple. I have a page MainPage.aspx and a popup window Popup.aspx. When users click on the linkbutton in the popup window I am looking to do some server side processing in Popup.aspx, then have the popup window close, and have the MainPage.aspx do a postback to the server. But I am having trouble determining what client side javascript Popup.aspx should render after it does its server side
9
4908
by: tshad | last post by:
This is from my previous post, but a different issue. I have the following Javascript routine that opens a popup page, but doesn't seem to work if called from an asp.net button. It seems to work fine from a link. The button does bring up the popup window, but when I press the links on the page, it doesn't return or close the window. ****************************************************************************
4
4577
by: Matt Jensen | last post by:
Howdy all Hopefully I can explain my problem straightforwardly. In it's simplest explanation, what I want to do is have a hyperlink that, when clicked, executes some client side JavaScript and then saves every form element value and reloads the page (with the 'save' being much the same as what is achieved by an AutoPostBack="True" attribute on a web/html control). Actually it doesn't matter which order the JavaScript or 'save'...
4
5226
by: E | last post by:
I am having trouble with setTimeout working on a second call to the setTimeout function from a second page which is an html page. Here is the scenario. I have a web page and onload it calls a javascript function which calls setTimeout and will process a second javascript function "Warn" just before the session expires. The Warn function displays an html page with a button. A second timer is started to cause the html page to close...
6
2523
by: den 2005 | last post by:
Hi everybody, Question 1: How do you set the values from server-side to a client-side control or how do you execute a javascript function without a button click event? Question 2: How do you get response from a Confirm() popup window to uncheck all server-side checkboxes placed in a panle of a web user control? I am using ASP.Net 2.0, Thanks. Need info...
0
8478
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8821
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
8599
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
8670
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
6230
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
4225
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4409
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2813
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
2
2052
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.