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 5977929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:26:29+00:00 2026-05-22T21:26:29+00:00

Hi as my title suggest, i use the following code to dynamically load a

  • 0

Hi as my title suggest, i use the following code to dynamically load a portion of the page (here left id)

function callBackFunctionLoadNextBackInPage(data)
{
    //alert(data);
    $("#left").fadeTo(100,1);
    var data = $(data).find( '#left' );
    $("#left").html(data);
    if(supports_history_api())
    {
        history.pushState(null, null, loadNextBackInPage_URL);  
        if(!popEventListnerAdded) {
            window.addEventListener("popstate", function(e) {
            loadNextBackInPage(location.href);
            },false);
            popEventListnerAdded = true;
        }

    }
    else
    {

    }
}
function loadNextBackInPage(url,parm)
{
    //alert(url);
    loadNextBackInPage_URL = url;
    $("#left").fadeTo(100,.2);
    $.post(url,parm,callBackFunctionLoadNextBackInPage,'html');
}

Here is an example of how i do it (click on the show details link

Problem is:

It loads properly… but the javascript is not working. For example: 1. I use a discuss for comments and it doesnt load in the following section

Add a Comment using Facebook, Twitter, Yahoo!, DISQUS, OpenID or Anonymus

But if you refresh the browser it does load properly… I am loading all the scripts required first only… so why is it not working?

Also for example: The SHARE (Click here) button should expand using the following code:

<script language="javascript" type="text/javascript">
function showHideDiv()
{
    var divstyle = new String();
    divstyle = document.getElementById("share").style.display;
    if(divstyle.toLowerCase()=="block" || divstyle == "")
    {
        document.getElementById("share").style.display = 'none';
    }
    else
    {
        document.getElementById("share").style.display = 'block';
    }
}
</script> 

But it doesnot!… but works if i refresh the page(i.e load the url again)

Mainly i want the discuss commenting thing to work. I use the following codes to generate it

<div class="entry">
  <h2>Add a Comment using Facebook, Twitter, Yahoo!, DISQUS, OpenID or Anonymus </h2>
  <p>


  <div id="disqus_thread"></div>
<script>
    /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
    var disqus_shortname = '[written here]'; // required: replace example with your forum shortname

    // The following are highly recommended additional parameters. Remove the slashes in front to use.
     var disqus_identifier = 'page=show_song_details.php&songid=<?php echo $sid ?>&n=0&back=no';
     var disqus_url = '<?php echo $main_root.$_SERVER['REQUEST_URI']; ?>';
    var disqus_developer = 1 ;
    /* * * DON'T EDIT BELOW THIS LINE * * */
    (function() {
        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
        dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    })();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

  </p>


</div>
  • 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-05-22T21:26:30+00:00Added an answer on May 22, 2026 at 9:26 pm

    The problem is that jQuery strips out <script> tags whenever you create a jQuery object from a HTML string to do some DOM manipulations on it, in your case .find().

    Your best bet is to read the whole HTML as text, then use regular expressions to chop it up and put the relevant part into your document. You should also think about redesigning part of your project, as in my opinion loading parts of an external page with partial scripts is not a good practice and could be hard to maintain in the long term. Unless of course it’s a well thought out modular design you’ve got there and you know what you’re doing.

    This issue is an exact duplicate of a different thread, although I can’t vote to close it due to the bounty. Have a look at my answer here and see if it helps: jquery: Keep <script> tag after .find()

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

Sidebar

Related Questions

I am trying to use the jQuery CSV plugin, as documented here: http://code.google.com/p/js-tables/wiki/CSV According
As the title suggest... How can I apply a scrum process to anything that
As the title suggests, is it correct or valid to import/export static data from
As the title suggests, I am having trouble maintaining my code on postback. I
In page 40 of Marcus Zarra's Core Data book, he suggests that, since NSTreeController
As the title of my question suggest, how is it possible to loop through
Well as the title suggest, what is this Restful Web Service thing in Java,
As the title suggests, I'm trying and failing to get the following combination working
As the title suggest, I'm looking for a way to validate emails (or other
In my main layout page, I was to have this: <title> TITLE_FROM_CONFIG || @page_title

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.