Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery get - use the returned value
    primarykey
    data
    text
    <p>There are some postings about getting the returned value of the get-call. But my problem is still there.</p> <p>My source</p> <pre><code>... $.get("list.svc/XmlTestService", function (XmlData) { console.log(XmlData); }, "xml"); ... alert($Loc['Name']); ... </code></pre> <p>I get an XML-Document which is correct at the console. Normaly I have to proceed with the Xml to do something. This will be done in a separate function like this:</p> <pre><code>function GetOutXml (XmlData) { ... return { 'Name': ValueName } } </code></pre> <p>Now I need to close my gap between my get-call and the alert. I tried some different things but without success. One way was something like this:</p> <pre><code>... var $Xml = null; $.get("list.svc/XmlTestService", function (XmlData) { $Xml = XmlData; }, "xml"); var $Loc = GetOutXml($Xml); ... </code></pre> <p>But without success. I´m new with the World of JS (only basics). Normaly I build my source with an functional architecture.</p> <p>How can I do this right?</p> <p>Update: Okay...I solved my problem in a other way after reading a lot. Because to do every thing in anonymous function is not my way of thinking and it´s hard to read and follow after time.</p> <p>So what I did:</p> <pre><code>... var $Xml = null; $.ajax({type:'GET',url:"list.svc/XmlTestService",success: function(Data) { $Xml = Data;},dataType:'xml',async:false}); ... var $Loc = GetOutXml($Xml); ... </code></pre> <p>The important step is to do the job with the ajax-command because of the posibility to set async to false so it is sync.</p> <p>Thanks for helping me.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload