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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:58:12+00:00 2026-05-14T20:58:12+00:00

I have several javascripts at the head of my document, as well as at

  • 0

I have several javascripts at the head of my document, as well as at the bottom, near the body closing tag. I use jQuery to call an ajax element into place and the elements that are called, require these javascripts to function. How can I include these javascripts to work with the ajax call?

Example:

jQuery(document).ready(function(){ 

        jQuery("a[rel=VideoPreview1]").click(function(){
            jQuery("a[rel=VideoPreview1]").hide();
            jQuery("a[rel=HideVideoPreview1]").show();
            jQuery.ajax({
               type: "POST",
               url: "/Classes/Video.php",
               data: "action=getYoutubeVideos&artist=B.o.B&track=Nothin On You",
              success: function(data){
                 jQuery("#VideoPreview1").html(data);
               }
             });
            jQuery("#VideoPreview1").show();
        preventDefault();
        });
        jQuery("a[rel=HideVideoPreview1]").click(function(){
            jQuery("a[rel=VideoPreview1]").show();
            jQuery("a[rel=HideVideoPreview1]").hide();
            jQuery("#VideoPreview1").hide();
            preventDefault();
        });
        });

So that ajax function loads the content inside of the proper DIV element. The head contains the core files (i.e. jquery, tooltip, lightbox) and near the bottom of the code, the javascripts are referenced (i.e. load.tooltip(VideoPreview1))

Hope this is enough information now

  • 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-14T20:58:13+00:00Added an answer on May 14, 2026 at 8:58 pm

    Ok here is what I ended up doing:

    <script>
       function BottomVideoPlayer(){
          // MY JAVASCRIPT HERE
       }
       jQuery(document).ready(function(){
          init: BottomVideoPlayer();
       });
    
    </script>
    

    And then when I want to call it into Ajax:

    <script>
        jQuery.ajax({
          type: "POST",
          url: "/Classes/Video.php",
          data: "action=getYoutubeVideos&artist='.$Artist.'&track='.$Track.'",
          success: function(data){                      
          jQuery("#VideoPreview'.$SongID.'").html(data);
          init: BottomVideoPlayer();
          }
         });
    </script>
    

    Just wrapped my script around a function and initiate the function whenever I need it.

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

Sidebar

Related Questions

<html> <head> <script type=text/javascript src=http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js></script> </head> <body> <script type=text/javascript language=javascript> $.ajax({ type: GET, cache:
I am using jQuery 1.7.1 (but that's probably irrelevant). I have several JavaScript arrays
I have to use javascript to make links instead of for several unimportant reasons,
I want to execute an ajax call as soon as a document is loaded.
Another jQuery issue... I have tried this several times using class and id elements
This is doing my head in! I have a select element with several options,
I have a web page that pulls in several javascript files in the HEAD
I have a JQuery Mobile application and I seem to have several locations in
Well, my use of eventsource is crashing my browser. I have a simple page
I have a variable defined in script tags within the head of the document:

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.