Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Dec 2012
    Posts
    24
    Thanks
    4
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    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");

  • #3
    New Coder
    Join Date
    Dec 2012
    Posts
    24
    Thanks
    4
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •