Wednesday, 11 September 2013

Submitting a form using jquery template

Submitting a form using jquery template

I have this form that loads rows of data in a table format using form.
Than user updates some of the amount and submits the form. Form works
fine, I dont know how to submit the updated values from html page to jqery
function.
<div id="Sales">
<script id="salestTemp" type="text/x-jquery-tmpl">
<form id="salesForm" action ="">
<table class="" border="1" cellpadding="0"
cellspacing="0">
<thead>
<tr>
<th class="label"><a href="">Name<span
class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></a></th>
<th class="label"><a href="">$ Amount<span
class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></a></th>
</tr>
</thead>
<tbody>

<tr class="">
<td>{{=name}}</td>
<td>$&nbsp;&nbsp;<input type="text"
class="{{=id}}" id="Amount" value='{{=Amount}}'
/></td>
</tr>
{{/each}}
<tr>
<input type="submit" class="" id="submit" name=""
value="Save" />
</tr>
</tbody>
</table>
</form>
</script
</div>
I am using following for jquery
$(document).ready(function () {
$("#submit").click(function () {
alert("inside");
$.ajax {......};
});
});
When I hit submit it doesn't even hit .click function. Anyone knows how to
fix this or where to look? Thanks

No comments:

Post a Comment