lgs0626 发表于 2013-1-29 11:23:26

Ajax怎么传对象

<span style=""><div class="content" style="clear: both; display: block; border-top-width: 2px; border-top-style: solid; border-top-color: #006600;">我想用ajax操作 只更新这个div   
这个div 主要就针对“thisTest” 这个对象。
其实就是更新thisTest这个对象。
但是 我看XMLHttprequest只有responseText和responseXML  
就是说 只能接收Text 和Xml 怎么接收对象呢?

<div id = "TestChangDIV">
<div id="TestNameDIV">
<b>
题目:${thisTest.testName }
</b>
</div>


<div id="TestAnswerDIV">
<c:forEach items="${thisTest.answers}" var="answer" varStatus="a">
${a.index+1 } :
 <input type="checkbox" id="${answer.id }"
  name="check${answer.rightOrNot }">
 <span id='span${answer.rightOrNot }'>${answer.answerValue} </span>
 </input>
 <p />
</c:forEach>
</div>
<div id="descriptionDIV">
<table border="1" style="font-size:13px;color:gray">
<tr>
<th>
本题难度
</th>
<th>
做过本题人数
</th>
<th>
做对本题人数
</th>
<th>
本题来源
</th>
<th>
出题老师
</th>
</tr>
<tr>
<td>
${thisTest.difficulty }
</td>
<td>
${thisTest.doneUc }
</td>
<td>
${thisTest.rightUc }
</td>
<td>
<a href="#">
${thisTest.testFrom }
</a>
</td>
<td>
<a href="#">
${thisTest.teacherName }
</a>
</td>
</tr>
</table>
</div>

<div id="answerDIV">
<div id="judgeDIV" style="color:red"></div>
用时:
<span id="timeDIV"></span>

<p />
本题正确答案将以红色字体显示!
<p />
试题详解:${thisTest.testDesc}
</div>
</div>
 
服务器端如果用 response.getWriter().print("nextTest");
这样发过去的就是text 那要怎么发对象呢?
 
<
页: [1]
查看完整版本: Ajax怎么传对象