編集:
/echo/html/
これは、 jQueryを使用した作業バージョン$.ajax()
です。
$(document).ready(function(){
var $button = $('#createissue');
var test = function(){
$.ajax({
url: '/echo/html/',
type: 'post',
success: show,
data: {
delay: 5,
html: '<table><tr>' +
'<th>summary</th><td>This is a summary for an issue</th>'+
'<th>reporter</th><td>Christopher Robin</th>'+
'<th>assignee</th><td>Jared from Subway</th>'+
'<th>securitylevel</th><td>Hands in the air! Everyone is suspect.</th>'+
'<th>description</th><td>Something descriptive goes here, I suppose.</th>'+
'</tr></table>'
}
});
};
var show = function(table) {
console.log(table);
$(document.body).append(table);
};
$button.click(test);
});
http://jsfiddle.net/userdude/YCecC/1/
どこかにあることは知っていましたが、残念ながら、純粋な html バージョンの準備ができていません。
var test = function(){
$.ajax({
url: '/echo/json/',
success: show,
type: 'post',
data: {
delay: 5,
json: JSON.stringify({
summary: 'This is a summary for an issue',
reporter: 'Christopher Robin',
assignee: 'Jared from Subway',
securitylevel: 'Hands in the air! Everyone is suspect.',
description: 'Something descriptive goes here, I suppose.'
})
}
});
};
var show = function(json) {
var $row,
$cell,
rows = {};
$tbody.empty();
for (field in json) {
$row = $tr.clone();
$cell = $td.clone();
$cell.text(field);
$row.append($cell);
$cell = $td.clone();
$cell.text(json[field]);
$row.append($cell);
rows[field] = $row;
}
$tbody.append(
rows.summary,
rows.securitylevel,
rows.reporter,
rows.assignee,
rows.description
);
$table.append($tbody);
$(document.body).append($table);
};
http://jsfiddle.net/userdude/YCecC/