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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:08:49+00:00 2026-06-05T10:08:49+00:00

I’m having trouble getting jquery functions (datepicker and dialog) to work within an jquery

  • 0

I’m having trouble getting jquery functions (datepicker and dialog) to work within an jquery ajax loaded tab.

I keep getting a “datepicker is not a function” or “dialog is not a function” when I click the respective tab. I’ve done a lot of searching online for this problem and there are similar problems, but I couldn’t find a solution that works for me.

I do understand that with such an error, the problem is likely due the system not recognizing the script. So, on a higher level I’m not really understanding how the ajax loaded tab deals with scrips in relation to the master script.

Hopefully my code can help illustrate my error.

header.html

<head>
...
<!-- External javascript call -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" charset="utf-8"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" charset="utf-8"></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js" charset="utf-8"></script>
<script type="text/javascript" src="../js/main.js"></script>    
</head>

Main.php

<?php include '../includes/header.html'; ?>
...
<div id="tabmenu" class="ui-tabs">
<ul>
<li><a href="view_sch.php"><span>Schedule</span></a></li>
</ul>
<div id="view_sch.php" class="ui-tabs-hide">Schedule</div>
</div><br />

view_sch.php (header.html isn’t included)

<head>
<!-- External javascript call -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" charset="utf-8"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" charset="utf-8"></script>
<script type="text/javascript" src="../js/schedule.js"></script>
</head>

<body>
<div id="AddGameForm" title="Add New Game">         
<form method="post">
<label for="date">Select Game Date:</label>
<input type="text" name="date" id="date" tabindex="-1" size="10" maxlength="10"    class="text ui-widget-content ui-corner-all" 
value="<?php if (isset($_POST['date'])) echo $_POST['date']; ?>" />
</form>
<table id="schedule"></table>
</body>

schedule.js

var GAME = {

loadDialog: function() {
    $( "#date" ).datepicker();
    $( "#AddGameForm" ).dialog({
        autoOpen: false,
        height: 400,
        width: 400,
        modal: true,
        buttons: {
            "Add New Game": function() {
                // Add game to database
                GAME.add();                     
                $( this ).dialog( "close" );
            },
            Cancel: function() {
                $( this ).dialog( "close" );
            }
        }
    });

    $( "#add-game" )
        .button()
        .click(function() {
            $( "#AddGameForm" ).dialog( "open" );
    });     
},

add: function() { 
    var form_data = $('form').serialize();
    $.ajax({
        type: "POST",
        url: "../manager/add_game.php",
        data: form_data, // Data that I'm sending
        error: function() {
            $('#status').text('Update failed. Try again.').slideDown('slow');
        },
        success: function() {
            $('#status').text('Update successful!').slideDown('slow');
        },
        complete: function() {
            setTimeout(function() {
                $('#status').slideUp('slow');
                }, 2000);
        },
        cache: false
    });
  }
}

$(document).ready(function() {
// Load game dialog
GAME.loadDialog();
});

Thanks for any help.

EDIT: I should note that the view_sch.php page works just fine when you view it in it’s own browser window. The issue arises when viewing the page through the ajax loaded jquery tab.

  • 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-05T10:08:50+00:00Added an answer on June 5, 2026 at 10:08 am

    I think I figured it out (with help of my friend too). I first removed the redundant external script calls in the view_sch page since header.html already took care of this. Next, I utilized the functions within the jquery tab, in particular the “load” event to create a callback situation. Ironically, it still wasn’t working if you select the tab more than once until I added an if conditional to the load block. Hopefully the code below helps others out there.

    schedule.js

    var GAME = {
     loadDialog: function() {
        $("#date").datepicker();
        $( "#AddGameForm" ).dialog({
            autoOpen: false,
            height: 400,
            width: 400,
            modal: true
            }
        });     
      }
    } 
    $(document).ready(function()
    {
      // jQuery UI Tabs
      $('#tabmenu').tabs({
        ajaxOptions: {
            error: function( xhr, status, index, anchor ) {
                $(anchor.hash).html(
                    "Couldn't load this tab. We'll try to fix this as soon as possible. "
                );              
            }
        },
        load: function ( event, ui ) {
            if (ui.index == 2) {
                // Load game dialog
                GAME.loadDialog();
    
                $( "#add-game" ).on("click", function() {
                    $( "#AddGameForm" ).dialog( "open" ); 
                }); 
            }
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I need a function that will clean a strings' special characters. I do NOT
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.