Convert XML nodes to raw text

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ruskalym
    New Member
    • Sep 2007
    • 65

    #1

    Convert XML nodes to raw text

    Hello,

    I am trying to make a dynamic AJAX form in a webpage and I want to dynamically change a <select> box's options.

    So I have a server-side PHP script which generates following response :

    Code:
    <?xml version="1.0" encoding="iso-8859-1"?>
    <WebResponse>
    <WebResponseInd id="0">
    <Response>
    <Result>
      <option value="1">First option</option>
      <option value="2">Second option</option>
    </Result>
    </Response>
    </WebResponseInd>
    </WebResponse>
    I want to insert options that lay within the <Result> tag directly into the webpage using document.getEle mentById("mySel ect").innerHTML .

    The problem is that getElementsByTa gName('Result') .item(0).nodeVa lue returns an empty string.

    Is there any way to convert the node to text or string ?

    Rus.
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    what about:

    [CODE=javascript]getElementsByTa gName('Result') .innerHTML
    [/CODE]
    ?? :)

    kind regards

    Comment

    • rnd me
      Recognized Expert Contributor
      • Jun 2007
      • 427

      #3
      you generally can/should not use .innerHTML to build options.

      build them manually, in a loop, and add each one separately.

      Comment

      Working...