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

  • Home
  • SEARCH
  • 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 7938003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:40:57+00:00 2026-06-03T22:40:57+00:00

Lets say i have this javascript code in an html pages <script type=text/javascript> $(document).ready(function(){

  • 0

Lets say i have this javascript code in an html pages

<script type="text/javascript">
$(document).ready(function(){ $('.info2').CreateBubblePopup({ position : 'left', align : 'center',
innerHtml: 'some text ',
innerHtmlStyle: { color:'#FFFFFF', 'text align':'center' },
themeName: 'all-black',
themePath: 'images/jquerybubblepopup-themes' }); }); 
</script>           

I want to make this script get the “info2” and the “some test” from the xml files i have in which i added a tag for “info2” called <-INFOID-> and a tag for “some text” called “<-INFODATA-> (without the -, just added them coz the tags where disappearing)
so i used this code below to connect the xml and to write the script

<script type="text/javascript">
if (window.XMLHttpRequest)
 {// code for IE7+, Firefox, Chrome, Opera, Safari
 xmlhttp=new XMLHttpRequest();
 }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.open("GET","scores.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML; 

document.write("<script type='text/javascript'>");
var x=xmlDoc.getElementsByTagName("GAME");
for (i=0;i<x.length;i++)
  { 
  document.write("$(document).ready(function(){ $('.");
  document.write(x[i].getElementsByTagName("INFOID")[0].childNodes[0].nodeValue);
  document.write("').CreateBubblePopup({ position : 'left', align : 'center',");
  document.write("innerHtml: '");
  document.write(x[i].getElementsByTagName("INFODATA")[0].childNodes[0].nodeValue);
  document.write("',");
  document.write("innerHtmlStyle: { color:'#FFFFFF', 'text-align':'center' },");
  document.write("themeName: 'all-black',");
  document.write("themePath: 'images/jquerybubblepopup-themes' }); });");

  }
document.write("</script>");
</script>    

I have no idea if XML works in Javascript i was just giving it a try but it didnt work
so does xml work with javascript? if yes what is wrong in my code?

My scores.xml file looks :

<SCORES>
<GAME>
<DATE>14.5.2012 12:05</DATE>
<TIME>FT</TIME>
<HOMETEAM>Team1</HOMETEAM>
<SCORE>4 - 0</SCORE>
<AWAYTEAM>Team2</AWAYTEAM>
<OTHER> </OTHER>
<INFO><![CDATA[<img class='info1' src='images/info.png' width='14px' height='14px' border='0' />]]></INFO>
<INFOID>info1</INFOID>
<INFODATA>FIRST BUBBLE</INFODATA>
</GAME>

<GAME>
<DATE>14.5.2012 12:05</DATE>
<TIME>FT</TIME>
<HOMETEAM>Team3</HOMETEAM>
<SCORE>2 - 0</SCORE>
<AWAYTEAM>Team4</AWAYTEAM>
<OTHER> </OTHER>
<INFO><![CDATA[<img class='info2' src='images/info.png' width='14px' height='14px' border='0' />]]></INFO>
<INFOID>info2</INFOID>
<INFODATA>SECOND BUBBLE</INFODATA>
</GAME>
</SCORES>

the other tags i used them in the page…
the last 2 tags are to configure this script which is a pop up bubble for a lil img

  • 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-03T22:40:59+00:00Added an answer on June 3, 2026 at 10:40 pm

    Look into jQuery’s XML parser: http://api.jquery.com/jQuery.parseXML/.

    It’ll also do the AJAX retrieval for you and can in fact handle XML immediately: http://api.jquery.com/jQuery.get/

    Example below (relatively untested):

    <script type="text/javascript">
    $(document).ready( function ( ) {
        // Get the XML data from your file
        $.get('demo.xml', function( data ) {
    
            // Because we've given jQuery the XML datatype, we can jump straight to finding the element.    
            $(data).find('GAME').each( function ( ) {
    
                // The current object now holds a single "GAME" - find the elements we need
                var game_id = $(this).find('INFOID').text( );
                var game_info = $(this).find('INFODATA').text( );
    
                // Create the popup.
                $('.'+game_id).CreateBubblePopup({
                        position : 'left', align : 'center',
                        innerHtml: game_info,
                        innerHtmlStyle: { color:'#FFFFFF', 'text align':'center' },
                        themeName: 'all-black',
                        themePath: 'images/jquerybubblepopup-themes'
                });
            }); // end of each
        }, 'xml'); // The 'xml' tells jQuery to expect XML back from the request
    });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say have this immutable record type: public class Record { public Record(int x,
Lets say I have this code: <?php class hello { var $greeting = hello;
Lets say we have this code: bool KeepGoing = true; DataInThread = new Thread(new
Lets say I have this code: public void MyMethod(string Data, List<string> InputData) { //I
Lets say we have this text The 85 kilos guy rant 10 miles and
Let's say we have the following JavaScript/jQuery code below function createElement(i, value) { return
Lets say I have this code: <div class=user> <img class=profilepic src=someimage.jps> <div class=cleaner></div> [
lets say we have the code below: <html> <head> </head> <body> <p id=paragraph> <h1>HELLO</h1>
Hi guys lets say I have the following html: <div class=owner> <div> <a href=javascript:void(0)
Lets say i have this usercontrol public class test : UserControl { public int

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.