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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:15:22+00:00 2026-06-05T08:15:22+00:00

I have a simple website that grabs html using ajax and place it in

  • 0

I have a simple website that grabs html using ajax and place it in some div (AjaxPlaceHolder).

For example here is my webpage:

<html>

    <body>
           // some html...

           <div id="AjaxPlaceHolder"></div>

    </body>

    <div id="footer"></div>

</html>

now my problem is that when I get the html using ajax I get something like:

<script type="text/javascript" src="js/someJsFile.js"></script>
<table>html content</table>
// more html

note the line:

<script type="text/javascript" src="js/someJsFile.js"></script>

I don’t want to place the html content until the browser downloads that file (someJsFile.js). How could I be able to tell when the browser downloads that script? I know I can place the someJsFile.js content in there and wrap it around <script type="text/javascript"> tags but it will be nice if I could have the .js files separated.

edit:

Here is what I will like to do in other words:

get html using ajax. don’t render the html (place it meanwhile in a hidden div) utnill the document is done downloading the necessary images and scripts

  • 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-05T08:15:23+00:00Added an answer on June 5, 2026 at 8:15 am

    You can separate the javascript file load, from the rest part of your html ajax load.

    If you separate it you can synchronous load the external scripts, and that way you can be sure that they loaded first.

    in simple javascript you set the Synchronous flag when you make open.

    function getFile(url, passData) {
      if (window.XMLHttpRequest) {              
        AJAX=new XMLHttpRequest();              
      } else {                                  
        AJAX=new ActiveXObject("Microsoft.XMLHTTP");
      }
      if (AJAX) {
        AJAX.open("POST", url, false);
        AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        AJAX.send(passData);
        return AJAX.responseText;                                         
      } else {
         return false;
      }                                             
    }
    
    var fileFromServer = getFile('http://domain.com/scr.js', sendThisDataAsAPost);
    

    In jQuery

    jQuery.ajax({
            type: "GET",
            url: url,
             async : false,
            success: callback,
            dataType: "script",
            cache: true
    });
    

    About Synchronous call : http://www.hunlock.com/blogs/Snippets:_Synchronous_AJAX

    jQuery call : http://api.jquery.com/jQuery.ajax/

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

Sidebar

Related Questions

I am using jQuery for a simple website and have a main page 'index.html'
I have a simple website that has some related python scripts that I use
So I have a really simple form on a website that's entirely AJAX based
I have a website that has an index.php, a few simple .html pages and
We have a simple website that contains (take your pick, for this example) blog
I have created simple web service for my website that generates some json based
I have a simple MVC website that displays a jquery dialog for editing purposes.
I just have a simple vb.net website that need to call a Sub that
I have a very simple one page website that has a input field in
I have a fairly simple website layout thus far and notice that if I

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.