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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:03:36+00:00 2026-05-25T10:03:36+00:00

In my page body, I need to insert this code as the result of

  • 0

In my page body, I need to insert this code as the result of an AJAX call:

    <p>Loading jQuery</p>
    <script type='text/javascript' src='scripts/jquery/core/jquery-1.4.4.js'></script>
    <p>Using jQuery</p>
    <script type='text/javascript'>
        $.ajax({
            ...
        });
    </script>

I can’t use $.load() since the document has already loaded, so the event doesn’t fire.

Is this safe? If not, how do I make sure the jquery script has loaded before my custom, generated code is executed.

  • 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-25T10:03:36+00:00Added an answer on May 25, 2026 at 10:03 am

    It is pretty safe. Historically, <script> tags are full blocking, hence the second <script> tag can’t get encountered befored the former has finished parsing/excuting. Only problem might be that “modern” browsers tend to load scripts asynchronously and deferred. So to make sure order is correct, use it like this:

    <p>Loading jQuery</p>
    <script type='text/javascript' async=false defer=false src='scripts/jquery/core/jquery-1.4.4.js'></script>
    <p>Using jQuery</p>
    <script type='text/javascript'>
        $.ajax({
            ...
        });
    </script>
    

    However, it’s probably a better idea it use dynamic script tag insertion instead of pushing this as HTML string into the DOM. Would be the same story

    var scr  = document.createElement('script'),
        head = document.head || document.getElementsByTagName('head')[0];
        scr.src = 'scripts/jquery/core/jquery-1.4.4.js';
        scr.async = false; // optionally
    
    head.insertBefore(scr, head.firstChild);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is my code <script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js></script> <script src=http://jquery-translate.googlecode.com/files/jquery.translate-1.3.7.min.js></script> <script type=text/javascript> jQuery(function($) { //when DOM
Here is my page. I need to insert whole code here. <!DOCTYPE html PUBLIC
I am using a way to insert some javascript code in the page which
The main structure of the page is like this: <html> <body> <div id=Menu> <h1>Menu</h1>
Maddening problem here. When my page loads: <body onload=getClientDateTime();> It runs this function: document.getElementById('ClientDateTime').value=hello
I am new to jQuery / AJAX. I have a page that uses colorbox
This is the code I have: <body> <form id=form1 runat=server> <div> <asp:TextBox ID=txtInsertComments CssClass=expanding
I need some help on how to set up this page. Let's say I
I need a jquery to function to run on page load. I could not
i need to get on line of data to a web site page (title,body...).

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.