Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-16-2013, 04:28 PM   PM User | #1
Webbot
New Coder

 
Join Date: Dec 2012
Posts: 24
Thanks: 4
Thanked 0 Times in 0 Posts
Webbot is an unknown quantity at this point
Load content to popup

I am using this script to view some popups in a site:

http://codeissue.com/articles/a04daf...ascript-jquery

The script make the popup show up (a hidden div in the page) when click on a button/text like this example:

Code:
<a href="#" onclick="ShowModalPopup('name_of_div_in_popup_box'); return false;">Text</a>
The "problem" with this is that the div thats containing the content (#name_of_div_in_popup_box) to the checkbox always must be in the page, so if I have 10 pages that will have this popup all 10 pages must contain 10 exacly same divs, and if make changes in the popup I must change the div in all 10 different pages.

So I wounder if its possible to load in the content to this popup from a external page in the same website at click to open the popup.

Is this maybe possible with jquery load()?

Thanks.
Webbot is offline   Reply With Quote
Old 01-16-2013, 07:48 PM   PM User | #2
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
give this a shot

Code:
function MyCustomPopUp(element, content){
var CustomContent;
if (!content) {
ShowModalPopup(element)
} else {
CustomContent = content;
$(#"+element+").html(content);
ShowModalPopup(element)
}
}
onclick="MyCustomPopUp('name_of_div_in_popup_box');
onclick="MyCustomPopUp('name_of_div_in_popup_box',"MY CUSTOM CONTENT");
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Old 01-17-2013, 08:07 AM   PM User | #3
Webbot
New Coder

 
Join Date: Dec 2012
Posts: 24
Thanks: 4
Thanked 0 Times in 0 Posts
Webbot is an unknown quantity at this point
Quote:
Originally Posted by DanInMa View Post
give this a shot

Code:
function MyCustomPopUp(element, content){
var CustomContent;
if (!content) {
ShowModalPopup(element)
} else {
CustomContent = content;
$(#"+element+").html(content);
ShowModalPopup(element)
}
}
onclick="MyCustomPopUp('name_of_div_in_popup_box');
onclick="MyCustomPopUp('name_of_div_in_popup_box',"MY CUSTOM CONTENT");
Thanks for your reply!

Newbie I am I dont really understand where to put the link to the content page, do you mean like this example?

Code:
function MyCustomPopUp(element, content){
var CustomContent;
if (!content) {
ShowModalPopup(element)
} else {
CustomContent = content;
$(#"+element+")content_page.html #content_div(content);
ShowModalPopup(element)
}
}
onclick="MyCustomPopUp('name_of_div_in_popup_box');
onclick="MyCustomPopUp('name_of_div_in_popup_box',"content_page.html #content_div");

Last edited by Webbot; 01-17-2013 at 08:10 AM..
Webbot is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:01 PM.


Advertisement
Log in to turn off these ads.