Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8910487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:42:07+00:00 2026-06-15T03:42:07+00:00

Currently i use a fine working code for opening a modal with Jquery :

  • 0

Currently i use a fine working code for opening a modal with Jquery :

            $(document).ready(function(){          
            $("span.ico-detail").click(function(){
                modal.open({content: "View detail of " + $(this).parent().parent().attr("id")});
                e.preventDefault();
            });
        });

And now the problem is : How can I use modal.open to open a HTML file named “view.html”, which contaning the string of “View detail of “?

What should I change the content : “xxx” with, so I can open the HTML file (view.html) and join it with other text ?

Thanks before.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:42:08+00:00Added an answer on June 15, 2026 at 3:42 am

    If the view.html is stored on a server and its content is static, then you can choose to preload the content of the file using ajax.

    $(function () {
        window.myAppNs = {
            viewContent: null;
        };
    
        $.ajax({
            url: 'view.html',
            dataType: 'html',
            type: 'GET'
        }).done(function (resp) {
            myAppNs.viewContent = resp;
        });
    
        $("span.ico-detail").click(function(){
            modal.open({content: myAppNs.viewContent + $(this).parent().parent().attr("id")});
            e.preventDefault();
        });
    });
    

    I am creating a global variable myAppNs. This will hold all app related variables. The idea is not pollute the global namespace with unnecessary variables. There are better and safer ways to create a namespace. If that interests you, you can google for the same.

    The ajax call preloads the content of the view.html and stores it in myAppNs.viewContent. The click handler reads that content from the variable.

    There is a slight chance that the user can click the element before the ajax response is returned. If that’s an issue, you can always move the namespace creation and ajax call out of document.ready and place it in the head section, immediately after referencing jquery. That ought to give the browser enough time to fetch the content before the dom is ready, but there is still that small possibility that the response might be delayed. If you need to ensure the user can click only if the data has been fetched, then bind the click handler inside the done callback of the ajax call.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently trying to use this gem http://github.com/pengwynn/linkedin . Everything works fine (i.e.
I am currently making a lot of use of code like this in order
I'm currently working on debugging some code with my android project. I'm having an
I currently use SVN for a number of things that aren't exactly code, for
I'm currently working on a project where I need to use a lot of
Currently I use Facebook php-sdk . Example code from the tutorial. $session = $facebook->getSession();
I currently have a $.getJSON call which is working fine as shown below. var
I currently use Zend_Db to manage my queries $stmt = $db->prepare(INSERT INTO test (ID_Test)
I currently use Devise 2.1 + Rails 3.2.x to authenticate users. I'm also going
I currently use the rectangle shape xml tag to specify borders for my views

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.