function generateReport() { try { var getUrl = window.location; var baseUrl = getUrl.protocol + "//" + getUrl.host + "/"; var url = baseUrl + 'polarion/ImpactAnalysisTree/ImpactAnalysisTree?projectId=' + projectId; var parameters = ""; var Id = false; var title = false; var workItemId = document.forms["tracegraph"]["itemId"]; if (workItemId != null) { if (!workItemId.value.trim().length == 0) { parameters = '&op=search&workItemId=' + workItemId.value; Id = true; } } if (!Id) { $(".widget-errors").text("Enter a valid Work Item ID /Title to generate traceability report.").show(); return false; } // AJAX 异步请求 $.ajax({ url: url + parameters, method: 'POST', success: function(response) { Data = JSON.parse(response); }, error: function(error) { console.log(error); alert(error); } }); } catch (e) { console.log(e); alert(e); } return false; } 根据返回的值重新渲染下面代码 <FORM id="tracegraph"> <br /> <form name="tracegraph"> <div id="inputDiv"> <table> <tr> <td valign="center" align="right">Work Item ID </td> <td> <div class="autocomplete"> <input id="itemId" type="text" name="itemId" autocomplete="off" placeholder="Work Item ID" style="width: 225px;"> </div> </td> </tr> </table> </div> </form> <table> <tr> <td> <button onclick="generateReport()" class="reportbutton" style="margin-left: 18px;" VALIGN=MIDDLE ALIGN=CENTER> Display Report</button> </td> </tr> </table> <br> <div class="widget-errors"></div> <div id="mainSVG"></div>
时间: 2024-01-03 20:35:40 浏览: 64
根据返回的值重新渲染下面代码:
```html
<FORM id="tracegraph">
<br />
<form name="tracegraph">
<div id="inputDiv">
<table>
<tr>
<td valign="center" align="right">Work Item ID </td>
<td>
<div class="autocomplete">
<input id="itemId" type="text" name="itemId" autocomplete="off" placeholder="Work Item ID" style="width: 225px;">
</div>
</td>
</tr>
</table>
</div>
</form>
<table>
<tr>
<td>
<button onclick="generateReport()" class="reportbutton" style="margin-left: 18px;" VALIGN=MIDDLE ALIGN=CENTER>Display Report</button>
</td>
</tr>
</table>
<br>
<div class="widget-errors"></div>
<div id="mainSVG"></div>
</FORM>
```
阅读全文