Jquery reads xml

Feb 15, 2017 pm 03:51 PM
jquery xml

                                                                                         Please indicate the source when reprinting: Jquery reads xml

xml:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

<forStatus>

  <values>

    <content>全勤</content>

    <el>F</el>

  </values>

  <values>

    <content>出差</content>

    <el>D</el>

  </values>

  <values>

    <content>差旅途中</content>

    <el>T</el>

  </values>

</forStatus>

Copy after login


Jquyery

var option = "";

1

2

3

4

5

6

7

8

9

10

11

$.get('../Handler/AttendanceStatus.xml', function (d) {

                $(d).find('values').each(function () {

                    var $val = $(this);

                    var el = $val.find("el").text();

                    var des = $val.find("content").text();

                    option += "<option value=\"" + el + "\">" + des + "</option>";

                    //alert(option);

                });

                strAttendanceStatusSelect = "<select id=\"selItem\" name=\"Item\">" + option + "</select>";

                //alert(strAttendanceStatusSelect);

            });

Copy after login

The above is the content of Jquery reading xml. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article

Hot tools Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use PUT request method in jQuery? How to use PUT request method in jQuery? Feb 28, 2024 pm 03:12 PM

How to use PUT request method in jQuery?

How to remove the height attribute of an element with jQuery? How to remove the height attribute of an element with jQuery? Feb 28, 2024 am 08:39 AM

How to remove the height attribute of an element with jQuery?

jQuery Tips: Quickly modify the text of all a tags on the page jQuery Tips: Quickly modify the text of all a tags on the page Feb 28, 2024 pm 09:06 PM

jQuery Tips: Quickly modify the text of all a tags on the page

Use jQuery to modify the text content of all a tags Use jQuery to modify the text content of all a tags Feb 28, 2024 pm 05:42 PM

Use jQuery to modify the text content of all a tags

Comparison of Java libraries for XML parsing: Finding the best solution Comparison of Java libraries for XML parsing: Finding the best solution Mar 09, 2024 am 09:10 AM

Comparison of Java libraries for XML parsing: Finding the best solution

How to use PHP functions to process XML data? How to use PHP functions to process XML data? May 05, 2024 am 09:15 AM

How to use PHP functions to process XML data?

How do you parse and process HTML/XML in PHP? How do you parse and process HTML/XML in PHP? Feb 07, 2025 am 11:57 AM

How do you parse and process HTML/XML in PHP?

Understand the role and application scenarios of eq in jQuery Understand the role and application scenarios of eq in jQuery Feb 28, 2024 pm 01:15 PM

Understand the role and application scenarios of eq in jQuery

See all articles