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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:53:50+00:00 2026-05-19T14:53:50+00:00

I am trying to call some script in a newly ajax loaded tab but

  • 0

I am trying to call some script in a newly ajax loaded tab but it looks like the script blocks inside the tab are not being processed at all so when I go to call a function in the tab the function cannot be found. Is there a way to properly load the tab content such that the scripts are interpreted?

I have tried playing with the ajax options but that doesn’t seem to help.

$("#tabs").tabs({
            ajaxOptions: {
                error: function (xhr, status, index, anchor) {
                    $(anchor.hash).html("This tab not yet built, sorry bub.");
                },
                dataType: 'html'

            },
            spinner: 'Loading tabs...',
        });

In the tabs I have something like

<script type="text/javascript">
   function SetupTab(){
     alert('loaded');
   }
</script>

but

$("#tabs").bind("tabsshow", function(event, ui){ SetupTab();});

cannot find SetupTab. Even if I allow the tab to load and then attempt to call SetupTab from firebug it can’t be found.

  • 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-19T14:53:51+00:00Added an answer on May 19, 2026 at 2:53 pm

    if you try and bind any events/actions to a html element that does not exist yet i.e.

    $(document).ready(function(){
     //apply elemnt bindings here
    });
    

    when you do load the elements using ajax the elements will not take on the bindings you supplied on document ready because they did not exist at that point.

    Add a call back to your ajax call to then bind any events/functions to ur new html elements, then this should work.

    I think thats what you was reffering to.

    EDIT: try this.

    $("#tabs").bind("tabsshow", function(event, ui){ alert('loaded');}); 
    

    EDIT AGAIN: you could try this.

    make sure the page you are loading just contains the script itself and not the script tags and then use:

    //lets say the data returned from your ajax call:
    data = function SetupTab(){alert('loaded');}
    eval(data);
    

    then you could call that function no problem.

    EDIT 3RD TIME: if you cant remove the script tags from the page your load you could regex the html. with this pattern.

    pattern = /<script\b[^>]*>(.*?)</script>/i
    urscript = data.match(pattern);
    eval(urscript[1]);
    

    this should work.

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

Sidebar

Related Questions

I'm trying to call cycle_pages inside of my _create but I'm hitting some scoping
Hey I was trying to call a script to made some changes to an
I am trying to call a function, but am running into some struggles with
guys. I'm trying to call some AJAX Post trhu AngularJS, and I want to
I am trying to call a PHP function using AJAX. Below is the script
I am trying to use ajax call to get some values as JSON object
I am trying to call some functions whenever the mouse is moved wherever it
I'm trying to make my QTableWidget call some function when I change the values
I'm trying to create a simple Java app that uses JNI to call some
here I am trying to call overloaded constructor after some condition has met in

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.