Jump to content
Sign in to follow this  

xml to select document ready

Recommended Posts



I would like to populate the select onload. or document ready with jquery

I dont see why not working'

<!DOCTYPE html>
  <meta charset="utf-8">
    <title>xml to select</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
$(document).ready(function() {
    type: "GET",
    url: "test.xml",
    dataType: "xml",
    success: function(xml) {
      $("#myDiv").append("<select id='mySelect'>");
        var a = $(this).text();
        $("#mySelect").append("<option class='nice' value='" + a + "'>" + a + "</option>");

<div id="myDiv"></div>

Thank you for your advice.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.