User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 455,964 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,609 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 2149 | Replies: 13
Reply
Join Date: Sep 2007
Posts: 81
Reputation: justapimp is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
justapimp justapimp is offline Offline
Junior Poster in Training

Help Would like to pass two parameters to a function that is outside of a web page.

  #1  
Nov 20th, 2007
my application makes extensive use of the Google map and I would like to know how I can pass latitude and longitude information obtain from one page to the next. the function I like to access exist in a completely different web page located on our server.

The problem seems very straight forward but I don't know how to accomplish the task. However, I would appreciate anyone who can point me in the right direction.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2007
Location: Birmingham
Posts: 378
Reputation: Fungus1487 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 38
Fungus1487's Avatar
Fungus1487 Fungus1487 is offline Offline
Posting Whiz

Re: Would like to pass two parameters to a function that is outside of a web page.

  #2  
Nov 21st, 2007
1. open your new page window (make sure you save the window to a variable i.e. 'win')
var win = window.open(....);
2. from existing page check the new window youve opened to see if it is finished loading. If it has then call the function if not set timeout to try again
checkwin(){
    if(win.document.readyState == 'complete') {
        win.functionname(variable1, variable2);
    } else {
        settimeout('checkwin()', 1000);
    }
}
checkwin();
When Autumn Falls [ http://www.whenautumnfalls.co.uk ] &&
Designdotworks [ http://www.designdotworks.co.uk ] Web / Graphic / Software Design
Reply With Quote  
Join Date: Sep 2007
Posts: 81
Reputation: justapimp is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
justapimp justapimp is offline Offline
Junior Poster in Training

Re: Would like to pass two parameters to a function that is outside of a web page.

  #3  
Nov 21st, 2007
I am unclear about the first step. Is this implementation going to open a popup window or is it going to use the parent window? I have not tried it yet but it seems very simple.
Reply With Quote  
Join Date: Apr 2007
Location: Birmingham
Posts: 378
Reputation: Fungus1487 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 38
Fungus1487's Avatar
Fungus1487 Fungus1487 is offline Offline
Posting Whiz

Re: Would like to pass two parameters to a function that is outside of a web page.

  #4  
Nov 21st, 2007
the implementation i stated opens a popup and passes 2 values throught to a function located on that page. are you doing the opposite and trying to obtain two values from the parent of the current window ?
When Autumn Falls [ http://www.whenautumnfalls.co.uk ] &&
Designdotworks [ http://www.designdotworks.co.uk ] Web / Graphic / Software Design
Reply With Quote  
Join Date: Sep 2007
Posts: 81
Reputation: justapimp is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
justapimp justapimp is offline Offline
Junior Poster in Training

Re: Would like to pass two parameters to a function that is outside of a web page.

  #5  
Nov 21st, 2007
No, Your first assumption is correct; however, I was trying to avoid pop-up since most of our users don't know how to deal with pop-up especially if they have pop-up blocker enabled. I wanted to pass the value to the page while I opened it up like a normal web page.
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 7,009
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 25
Solved Threads: 368
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Lazy, Useless & Apathetic

Re: Would like to pass two parameters to a function that is outside of a web page.

  #6  
Nov 21st, 2007
Is the event which initiates the sending of information from one page to another user initiated? Do you want this to be done server side or client side?

If you want to do it server side, just set those values in hidden fields, extract those using the server side language of your choice and send the response page to the client with the given values set (here I am talking about J2EE servets). If you want to do it using Javascript, just set the href property of the location object.

location.href = 'http://www.google.com?var1=' + var1 + '&var2=' + var2;
Encode values if needed.
Last edited by ~s.o.s~ : Nov 21st, 2007 at 1:08 pm.
I don't accept change. I don't deserve to live.

Happiness corrupts people.

Failing to value the lives of others cheapens your own.
Reply With Quote  
Join Date: Sep 2007
Posts: 81
Reputation: justapimp is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
justapimp justapimp is offline Offline
Junior Poster in Training

Re: Would like to pass two parameters to a function that is outside of a web page.

  #7  
Nov 21st, 2007
Yes. the event is user initiated. I figured when the user initiated the event, I can pass the lat and long value to the next page while loading and accessing the event.addlistener method of that page. what I would like to see happened is to have pass the arguments from the previous page to the next page and have the info window opened once its fully loaded (pretty much your first assumption).

I think the query string location.href.... would work well, however I don't see how I can automatically call the event.addlistener from that point.
Reply With Quote  
Join Date: Sep 2007
Posts: 81
Reputation: justapimp is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
justapimp justapimp is offline Offline
Junior Poster in Training

Re: Would like to pass two parameters to a function that is outside of a web page.

  #8  
Nov 21st, 2007
Fungus1487 thank you for your assistance. I am going to implement the methods we discussed and I will let you know if any of them work for me. meanwhile, if you have any other suggestion, please post them on the thread.
Reply With Quote  
Join Date: Apr 2007
Location: Birmingham
Posts: 378
Reputation: Fungus1487 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 38
Fungus1487's Avatar
Fungus1487 Fungus1487 is offline Offline
Posting Whiz

Re: Would like to pass two parameters to a function that is outside of a web page.

  #9  
Nov 21st, 2007
i agree with SOS that if you wish to do this without opening a popup then simply append your values to the path of the page calling then add an onload event to that page that checks to see if these variables are set. If so then fire away on whatever you wish to do with this info.
When Autumn Falls [ http://www.whenautumnfalls.co.uk ] &&
Designdotworks [ http://www.designdotworks.co.uk ] Web / Graphic / Software Design
Reply With Quote  
Join Date: Sep 2007
Posts: 81
Reputation: justapimp is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
justapimp justapimp is offline Offline
Junior Poster in Training

Re: Would like to pass two parameters to a function that is outside of a web page.

  #10  
Nov 21st, 2007
I do agree with SOS in a lot of ways and that is why I was looking at using the query string. I am in the process of implementing the suggestions for a test. If any of them work, I will post the result.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 9:00 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC