www.webdeveloper.com
Results 1 to 2 of 2

Thread: Get JSON value with Javascript

  1. #1
    Join Date
    Dec 2013
    Posts
    6

    Get JSON value with Javascript

    Hi All,


    I get the following value, when doing an xPath expression:

    Code:
    var xmlString = '{!xml}'
    var xpathExpr = "//code/text()";
    
    
    var res = evalXpath(xmlString, xpathExpr);
    for (var k=0; k<res.length; k++)
    print(res.item(k));
    The evalXpath is a built in function which i can use, when i print the result i get:

    [#text: 00]

    How can i catch the value 00. I have tried to put the result in a variable like:

    var obj = res.item(k);
    obj['#text'];

    I get nothing back, also without the quotes ( obj[#text] it is not working. The JSON result [#text: 00] doesnt contain the quotes around the labels. How can i get the value 00?

    Thanks in advance

  2. #2
    Join Date
    Dec 2013
    Posts
    6
    Maybe it is not JSON, because the result does not contain quotes and it starts with brackets [ in stead of {

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles