使用prototype.js经验积累
1、Ajax返回xml格式的对象
1)前台js
function viewIndexGrade(id){
var offsetObj = event.srcElement;
var url = "<ww:url value='/xxxAction!getIndexGrades.action'/>?obj.id=" + id;
var http = new Ajax.Request(url,
{method: 'get',
asynchronous: false,
onComplete:function(oriReq){
var divObj = document.getElementById("indexGradDiv");
var sb = "<table class='table-border' align='center' cellspacing='1' cellpadding='1' width='100%'>";
var responseDoc = oriReq.responseXML;
var records = responseDoc.documentElement.childNodes;
if(records.length > 0){
for(var i = 0; i < records.length; i++){
var indexCode = records[i].selectSingleNode("indexCode").text;
var grade = records[i].selectSingleNode("grade").text;
sb += "<tr>";
sb += "<td class='table-title' style='height:25px' align='left' width='40%'>" + indexCode + "</td>";
sb += "<td class='table-content' style='height:25px' align='center'>" + grade + "</td>";
sb += "</tr>";
}
sb +
相关新闻>>
- 发表评论
-
- 最新评论 更多>>