I have two div tags in single HTML with data-role as ‘page’. First one is a form which contains a table with two columns say A and B and a button.The second page contains a text box and dropdown and sublit button. On clicking of button in first page jquery should call web-service and should navigate to second div in which, the dropdown should be filled with result of webservice.
Finally on clicking submit whole data should be converted to a xml and should be posted to another webservice.
Please help me in this scenario
HTML PAGE
<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
<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);
}
});
});
Try