Solved

redirect after popup

Posted on 2010-08-20
8
517 Views
Last Modified: 2012-05-10
hello
what i am trying to is when a user logs out, popup a box saying you have logged out etc then load a redirect to the login page. can someone look at my code and tell me why it just redirects and the popup never happens? if i reove the redirect popup works fine. many thanks
<script type="text/javascript">
			//<![CDATA[
				$.setupJMPopups({
					screenLockerBackground: "#003366",
					screenLockerOpacity: "0.7"
				});

				function openStaticPopup() {
					$.openPopupLayer({
					name: "mySecondPopup",
					width: 550,
					target: "myHiddenDiv"
				});

				}
			//]]>
		</script>
		<script type="text/javascript">
				<!--
				window.location = "/sample/index.php"
				//-->
		</script>
		<div id="myHiddenDiv">
			<div class="popup">
				<div class="popup-header">
					<h2>Logistor Logout</h2>
					<a href="javascript:;" onclick="$.closePopupLayer('mySecondPopup')" title="Close" class="close-link">Close</a>
					<br clear="all" /><br /><br />
				</div>
				<div class="popup-body">
					<code>
						<pre>
								This is just a test
						</pre>
					</code>
			</div>
		</div>
		</div>

Open in new window

0
Comment
Question by:peter_coop
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 3

Expert Comment

by:mahadazad
ID: 33488026
The reason is very clear; when the page loads it is redirected instantly... You could do one thing, on the page load show the popup... and on the popup close event redirect the page.
0
 

Author Comment

by:peter_coop
ID: 33488480
hi. wanted to redirect while the popup was still active and let them close it. thanks
0
 
LVL 56

Expert Comment

by:HainKurt
ID: 33489180
what about a simple solution like this

<script>
alert("Goodbye, come back!");
window.location = "http://google.ca";
</script>
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:peter_coop
ID: 33489205
problem with that solution hainkurt is that it also closes the popup which i want to keep on top and let the client close the popup. i am using the code below which is called from this:

onload="openStaticPopup()"

many thanks
function openStaticPopup() {
	$.openPopupLayer({
	name: "mySecondPopup",
	width: 550,
	target: "myHiddenDiv",
	success: function() {
								window.location = '/sample/index.php';
								}
				});

Open in new window

0
 
LVL 56

Accepted Solution

by:
HainKurt earned 250 total points
ID: 33489260
ok do this...
on your popup

window.opener.window.location = '/sample/index.php';

and use this to open popup
function openStaticPopup() {
	$.openPopupLayer({
	name: "mySecondPopup",
	width: 550,
	target: "myHiddenDiv",
});

Open in new window

0
 

Author Comment

by:peter_coop
ID: 33489339
i am already doing that from the onload event. have i misunderstood u? thanks
0
 
LVL 56

Expert Comment

by:HainKurt
ID: 33490320
you run redirect from popup page in my suggested solution above
0
 

Author Closing Comment

by:peter_coop
ID: 33490863
thank you
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question