<form id="searchForm">
<button type="submit" id="createPayrollTransaction" class="saveButton" ">create Entries </button>
</form>
$(document).ready(function()
{
$("#createPayrollTransaction").click(function(){
$("#searchForm").submit(function(event) {
event.preventDefault();
var formData = $('form').serializeArray();
$.ajax({
url: 'callCreatePayroll',
type: 'POST',
data: formData,
dataType: 'html',
success: function(data){
alert(data);
}
});
});
});
});
//oData = new FormData(document.forms.namedItem("createPayrollTransaction"));
/*
var mmth="12";
var mmyr="2014";
var fd;
fd = new FormData();
var inputs = document.getElementsByTagName('input');
for(i=0;i<inputs.length;i++) {
fd.append(inputs[i].name, inputs[i].value);
}
*/
/*
$.post("callCreatePayroll",
{
myr:mmyr,
mth:mmth
},
function(data,status){
alert("Data: " + data + "\nStatus: " + status);
});
*/
沒有留言:
張貼留言