Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 29-06-2009
Member
 
Join Date: Apr 2008
Posts: 70
How to get a popup window using ajax?

Hi,
I am working with php website.
I am not very familiar with ajax but I want a popup window. I want to know is how to get a popup window using ajax? If anyone have the code or please let me guide in a proper direction it will be a great help.
I want to use popup window with ajax because
Much quicker to load as it can preload contents.
The display is really dynamic.

Thanks in advance.
Reply With Quote
  #2  
Old 29-06-2009
Member
 
Join Date: May 2008
Posts: 37
Re: How to get a popup window using ajax?

Hey I think this is what you are looking for.

This taglib lets you define a hyperlink that popups some window with your own HTML/JSP code.

Code:
<script language="JavaScript" src="cjajax.js"></script>

<%@ taglib uri="taglib.tld" prefix="ap" %>

What does
<ap:apopup onMouse="true" url="/servlet/MVC">it mean?</ap:apopup>
<br>Just click on the link or move your mouse over it.
Tag lets you request data from server side (attribute url) and display them in the popup window. Attribute urlFunction lets you define a JavaScript function that will construct URL for the request in dynamic.
Reply With Quote
  #3  
Old 29-06-2009
Member
 
Join Date: Apr 2008
Posts: 26
Re: How to get a popup window using ajax?

Here's the code I recommend:

Code:
var newWin = null;
function popUp(strURL, strType, strHeight, strWidth) {
 if (newWin != null && !newWin.closed)
   newWin.close();
 var strOptions="";
 if (strType=="console")
   strOptions="resizable,height="+
     strHeight+",width="+strWidth;
 if (strType=="fixed")
   strOptions="status,height="+
     strHeight+",width="+strWidth;
 if (strType=="elastic")
   strOptions="toolbar,menubar,scrollbars,"+
     "resizable,location,height="+
     strHeight+",width="+strWidth;
 newWin = window.open(strURL, 'newWin', strOptions);
 newWin.focus();
}
To call the function you would use the following code:

Code:
<a href="my-pop-up-window.htm"
 onclick="popUp(this.href,'console',400,200);return false;"
 target="_blank">This is my link</a>
You can put a condition to close the popup too.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to get a popup window using ajax?"
Thread Thread Starter Forum Replies Last Post
TWebBrowser popup window Problem (Delphi) lucky3664 Software Development 2 06-03-2012 11:25 AM
How to Open Popup Window in Javascript? Soumen Software Development 4 07-02-2010 04:02 AM
How to open Gmail account in a popup Window? roodiii Technology & Internet 5 01-02-2010 01:02 PM
To open a popup window with no toolbar. Zidaan Software Development 2 06-07-2009 10:20 PM
Popup a non-resizable window Alexxx Software Development 3 15-04-2009 09:26 AM


All times are GMT +5.5. The time now is 12:27 AM.