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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:36:18+00:00 2026-06-05T00:36:18+00:00

I am trying to pass variables from an xml file to the father class

  • 0

I am trying to pass variables from an xml file to the father class in js:
the code is basically OOP js.
The class is example and the method is getData().

the thing is that the ajax call doesn’t return the whole values, just the int ones.. weird, I know.

(changed due to T.J. Crowder:)

function example(){
    this.b;
    this.str;
}
example.prototype ={
    getData:function(){
        $.ajax({
                type: "GET",
                url: "Bar.xml",
                dataType: "xml",
                            context: this,
                success: function(xml) {
                    this.b = parseInt($(xml).find('current_madad').text()); //int_from_xml- works!
                           this.str = $(xml).find('graph_title').text(); //string_from_xml - doesnt work!!
            }
        })//end ajax    
    }
};

var c = new example();
c.getData();

the xml file is here. Posted so that you can review that code as well..

<?xml version="1.0" encoding="utf-8"?>
<root>
  <Bars>
    <Bar>
      <bar_start>1010</bar_start>
      <lower_danger_zone>1030</lower_danger_zone>
      <mid_safe_zone>1050</mid_safe_zone>
      <upper_danger_zone>1150</upper_danger_zone>
      <upper_fbdn_zone>1200</upper_fbdn_zone>
      <bar_range>200</bar_range>
      <ideal_range>5</ideal_range>
      <current_madad>1115</current_madad>
    </Bar>
  </Bars>
  <Bars_Desc>
    <Bar>
      <graph_title>פוזיצית אפריל</graph_title>
      <lower_fbdn_zone_Desc>תחום אסור תחתון תיאור</lower_fbdn_zone_Desc>
      <lower_danger_zone_Desc>תחום מסוכן תחתון תיאור</lower_danger_zone_Desc>
      <mid_safe_zone_Desc>תחום בטוח אמצעי תיאור</mid_safe_zone_Desc>
      <mid_safe_ideal_zone_Desc>תחום בטוח פקיעה אידיאלית תיאור</mid_safe_ideal_zone_Desc>
      <upper_danger_zone_Desc>תחום מסוכן עליון תיאור</upper_danger_zone_Desc>
      <upper_fbdn_zone_Desc>תחום אסור עליון תיאור</upper_fbdn_zone_Desc>
    </Bar>
  </Bars_Desc>
</root>
  • 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-05T00:36:20+00:00Added an answer on June 5, 2026 at 12:36 am

    got it! I am using the data I need and passing it throw a function inside ajax’s success!
    getData:function(){

    $.ajax({
            type: "GET",
            url: "Bar.xml",
            dataType: "xml",
            context: this,     // <=== Set `context` - this helped me BTW
            success: function(xml) {
               arr.f1 = 1;    // 
               arr.f2 = 876;
               pass_data_to_data_handler_function(arr); //<= so I am waiting for response
    
    })//end ajax
    

    }

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

Sidebar

Related Questions

Hi am trying to pass variables to php from inside an app. <?php //
I'm trying to pass some variables from PHP to JS. I saw here that
Im trying to pass some variables from the URL to the PHP script. Now
Ok so I am trying to pass some string variables from a classic ASP
I am trying to pass my variables from my main page to external JS
I am trying to pass two variables from one screen to another. From the
I'm trying to pass a variable from one include file to another. This is
I'm trying to use jQuery's $.post() method with variables from values taken from textboxes
I'm trying to pass some POST variables from hidden inputs (using JQuery to change
I'm new in AS 3.0. I'm trying to pass flash variables to SWF file

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.