A small example of Jquery accessing XML data through Ajax_jquery
Page js code
$.ajax({
url : '...',
type : 'POST',
dataType : 'xml',
error : function(xml) {
alert("Error loading XML document" xml);
},
success: function(xml) {
$(xml).find("X").each(function(i) {
alert($(this). attr("Xattr"));
});
}
});
Background output code
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
response.setContentType("text/xml; charset=utf-8");
response.setCharacterEncoding("utf-8");
PrintWriter pw = response.getWriter();
Document doc = new Document();//Get XML file
doc.write(pw);
return null;
}

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to get variables from PHP method using Ajax?

How to use PUT request method in jQuery?

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

Use jQuery to modify the text content of all a tags

PHP vs. Ajax: Solutions for creating dynamically loaded content

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

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

How to use PHP functions to process XML data?
