Skip to content

Instantly share code, notes, and snippets.

@tokkonopapa
Created June 11, 2011 09:12
Show Gist options
  • Save tokkonopapa/1020398 to your computer and use it in GitHub Desktop.
Save tokkonopapa/1020398 to your computer and use it in GitHub Desktop.
/echo/xml/
dl#xml {
border:1px solid #999;
width:240px;
}
dt.name {
float:left;
width:100px;
padding:5px 0 5px 10px;
clear:both;
font-weight:bold;
}
dd.maker {
width:120px;
margin-left:100px;
padding:5px 5px 5px 10px;
border-left:1px solid #999;
}
<dl id="xml"></dl>
$(function() {
// jQuery.post()
$.post("/echo/xml/", {
xml:"<車><乗用車><車名>プリウスα</車名><メーカー>トヨタ</メーカー></乗用車>" +
"<乗用車><車名>CR-Z</車名><メーカー>ホンダ</メーカー></乗用車></車>",
deley: 0
}).success(function(data, textStatus, jqXHR) {
console.log("jQuery.post()", textStatus, data);
$(data).find("乗用車").each(function() {
var name = $(this).find("車名").text();
var maker = $(this).find("メーカー").text();
$("#xml").append("<dt class='name'>" + name + "</dt><dd class='maker'>" + maker + "</dd>");
});
});
});
name: /echo/xml/
description: /echo/xml/ のテスト
authors:
- tokkonopapa
resources:
- https://getfirebug.com/firebug-lite-debug.js
normalize_css: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment