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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:25:58+00:00 2026-05-27T07:25:58+00:00

A simple ajax call, the php echos some xml text I need to appear

  • 0

A simple ajax call, the php echos some xml text I need to appear in JPayer where myAJAXVariable is.

I need something similar to php echo which simply prints the data.

I simply want myAJAXVariable to display the data from getxml2.php

$(document).ready(function() {



     var myAJAXVariable = $.get("http://www.freeenergymedia.com/getxml2.php", function(data){
return data; <!--here I am attempting to print the contents of getxml2.php as data-->
});



    new jPlayerPlaylist({
        jPlayer: "#jquery_jplayer_1",
        cssSelectorAncestor: "#jp_container_1"
    }, myAJAXVariable, {
        swfPath: "js",
        supplied: "mp3, oga",
        wmode: "window"
    });

});
  • 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-27T07:25:58+00:00Added an answer on May 27, 2026 at 7:25 am

    Due to the asynchronous nature of AJAX (which is what the first A stands for) you should consume the result of an AJAX call only inside the success callback, otherwise the data will not be initialized yet:

    $(document).ready(function() {
        $.get("http://www.freeenergymedia.com/getxml2.php", function(data) {
            // Only here you should use the data variable as it is here and only here
            // that it is assigned
    
            new jPlayerPlaylist({
                jPlayer: "#jquery_jplayer_1",
                cssSelectorAncestor: "#jp_container_1"
            }, data, {
                swfPath: "js",
                supplied: "mp3, oga",
                wmode: "window"
            });
        });
    });
    

    or create a function:

    var initializejPlayer = function(data) {
        new jPlayerPlaylist({
            jPlayer: "#jquery_jplayer_1",
            cssSelectorAncestor: "#jp_container_1"
        }, data, {
            swfPath: "js",
            supplied: "mp3, oga",
            wmode: "window"
        });
    } 
    

    and then trigger the AJAX call:

    $(document).ready(function() {
        $.get("http://www.freeenergymedia.com/getxml2.php", initializejPlayer);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple ajax call inside a javascript function to a php file,
I'm creating a simple ajax call to retrieve a list of user reviews. I
Does anybody know of any small and simple ajax/php to do lists which I
How can i track ajax call time out in the following simple ajax function
I'm working on a simple PHP application, using CouchDB and PHP-on-Couch to access some
I have a simple jquery ajax call which posts a car manufacturer and responds
I need to use the $.ajax() call within jQuery to post a little bit
I am just trying to test a simple ajax call on my server using
For a very simple ajax name lookup, I'm sending an id from the client
I had a realtivley simple ajax application, which I have broken up to be

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.