「ページ」としてのデータロールを持つ単一の HTML に 2 つの div タグがあります。1 つ目は、A と B の 2 つの列とボタンを含むテーブルを含むフォームです。2 つ目のページには、テキスト ボックスとドロップダウンとサブライト ボタンが含まれています。最初のページのボタンをクリックすると、jquery は Web サービスを呼び出し、2 番目の div に移動する必要があります。ドロップダウンには Web サービスの結果が入力されます。最後に、[送信] をクリックすると、データ全体が xml に変換され、別の Web サービスに投稿される必要があります。
このシナリオで私を助けてください
HTML ページ
<body>
<div data-role="page" id="page-a">
<div data-role="header"><h1>Place order</h1></div>
<div data-role="content">
<table align="center">
<tr>
<th>Part Number</th>
<th>Quantity</th>
</tr>
<tr>
<td><input type="text" id="t1"></td>
<td><input type="text" id="q1"></td>
</tr>
<tr>
<td><input type="text" id="t2"></td>
<td><input type="text" id="q2"></td>
</tr>
<tr>
<td><input type="text" id="t3"></td>
<td><input type="text" id="q3"></td>
</tr>
<tr>
<td><input type="text" id="t4"></td>
<td><input type="text" id="q4"></td>
</tr>
<tr>
<td><input type="text" id="t5"></td>
<td><input type="text" id="q5"></td>
</tr>
</table>
</div>
<center>
<div>
<a href="#page-b" id="nextpage" data-role="button">Next</a></center>
<!--<button onclick="jaffa()">NEXT </button>-->
</div>
</center>
</div>
<div data-role="page" id="page-b">
<div data-role="header"><h1>Head</h1></div>
<div data-role="content">
<table align="center">
<tr>
<td> <label for="uname" class="floatleft" >Customer Reference ID</label> </td>
<td> <input id="cref"type="text" name="name" size="20" data-mini="true" autocomplete="off" style="width:220px;" class="floatleft1"/></td>
</tr>
<tr>
<td><label for="address" class="floatleft">Address</label></td>
<td><select id="addr">
<option>--SELECT--</option>
</select></td>
</tr>
</table>
</div>
<div>
<button onclick="execute()"> place order </button>
</div>
</div>
脚本
<script type="text/javascript">
$.("#nextpage").click(function)() {
alert("jaffa");
$.ajax({
type: "POST",
url:"http://172.18.98.31/TrwAftermarket_M/login.asmx/GetShipToList",
data: {UserId:"TRW2008" , Storefront:"DE" , CustomerNumber:"987654"},
dataType: 'xml',
success:function(data, textStatus, jqXHR){
var xml = '';
xml = $(data).find('string').text();
xmlDoc = $.parseXML(xml),
$xml = $( xmlDoc ),
$(xml).find('shiptoName').each(function(){
var value = $(this).text();
//alert(value);
$(addr).append("<option class='ddlcustomer' value='"+ value +"'>"+value+"</option>");
});
},
error: function (jqXHR, textStatus, errorThrown) {
alert("Error occured");
alert(textStatus);
alert(errorThrown);
}
});
});