The script called New script is suppose to output 2 integer variables anchor and signed.
I would like to replace Old script with New script, but as you can see, they are very different.
Question
How do I submit/post anchor and signed in New script?
New script
$(window).load(function() {
$('form').delegate('input:submit', 'click', function() {
var anchor = this.name;
var checkboxState = $('#' + anchor).find('input:checkbox').is(':checked');
var signed = 0;
if (checkboxState == true) {
signed = 1;
}
alert(anchor + ' ' + signed);
return false;
});
});
Old script
// sends the form content to server side, and stay on page
$('form').live('submit', function() {
$.post($(this).attr('action'), $(this).serialize(), function(response) {
// do something here on success
}, 'json');
// don't redirect
return false;
});
HTML
<form action="/cgi-bin/receiver.pl" method="post">
Put thisin place of alert
Here is the proper one, and running ok.
http://jsfiddle.net/ergec/pJgyu/16539/