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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:41:10+00:00 2026-05-25T23:41:10+00:00

If I have the following in a page: $(document).ready(function () { alert(‘moo’); }); It

  • 0

If I have the following in a page:

$(document).ready(function () {
                    alert('moo');
                });

It will show the alert when I view that page BUT if that page is called via Ajax then the alert will not show… Any ideas why? Or how to get around this?

Note: This is test javascript and i’m not actually showing an alert in my real app

Thanks

Ajax jazz as requested:

$(document).ready(function ()
    {
        $('ul#ui-ajax-tabs li a').click(function (e)
        {
            e.preventDefault();
            $("ul#ui-ajax-tabs li").removeClass("selected");
            $(this).parents('li').addClass("loading");
            var url = $(this).attr("href");
            var link = $(this);
            $.ajax({
                url: url,
                success: function (responseHtml)
                {
                    //$('div#ui-tab-content').html($(responseHtml));
                    $('div#ui-tab-content').html($(responseHtml).find('div#ui-tab-content > div#ui-ajax-html'));
                    $(link).parents('li').addClass('selected');
                    $("ul#ui-ajax-tabs li").removeClass("loading");
                    History.pushState(null, $(responseHtml).filter('title').text(), url)
                },
                error: function (responseHtml)
                {
                    $('div#ui-tab-content').html('<div class="message error"><p><strong>Something went wrong...</strong> Please contact the Administrator!</p></div>');
                    $(link).parents('li').addClass('selected');
                    $("ul#ui-ajax-tabs li").removeClass("loading");
                    History.pushState(null, $(responseHtml).filter('title').text(), url)
                },
                statusCode:
                {
                    404: function (responseHtml)
                    {
                        $('div#ui-tab-content').html('<div class="message error"><p><strong>Error 404 (Not Found)</strong> Please contact the Administrator!</p></div>');
                        $(link).parents('li').addClass('selected');
                        $("ul#ui-ajax-tabs li").removeClass("loading");
                        History.pushState(null, 'Error 404 (Not Found)', url)
                    },
                    500: function (responseHtml)
                    {
                        $('div#ui-tab-content').html('<div class="message error"><p><strong>Error 500 (Internal Server Error)</strong> Please contact the Administrator!</p></div>');
                        $(link).parents('li').addClass('selected');
                        $("ul#ui-ajax-tabs li").removeClass("loading");
                        History.pushState(null, 'Error 500 (Internal Server Error)', url)
                    }
                }
            });
        });
    });
  • 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-25T23:41:11+00:00Added an answer on May 25, 2026 at 11:41 pm

    Your web page is text. The browser you use happens to interpret it when you request it from your servers.

    If you’re doing an ajax request, the content will be on a variable as a string waiting for you to do something. It doesn’t matter if it has scripts on it, it won’t auto execute.

    You would have to create a script element with that as innerText and append it to the DOM to have it executed by the browser.

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

Sidebar

Related Questions

I have the following code: $(document).ready(function({ $(.click).click(function(){ alert(' The Button Was Clicked !'); });
I have the following in my page. $(document).ready(function() { function setTheTimeout(){ var t=setTimeout(alertMsg(),3000); }
I have the following and in this order: <script type=text/javascript> $(document).ready(function(){ var overwrite =
I have the following code in a jQuery JavaScript document running on a page
i have following code to show div on page <div id=all_users> <div id=user11 userid=11
I have the following snippet of code on a page that I need to
I have the following jQuery function embedded in an MVC Razor page: <script type=text/javascript>
I have the following code with a form on my page. But when I
I have the following ASP page: <asp:Content ID=Content2 ContentPlaceHolderID=ShellContent runat=server> <form runat=server id=AddNewNoteForm method=post>
I have the following in a page e.g. /mypage?myvar=oldvalue $_SESSION['myvar'] = $_GET['myvar']; $myvar =

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.