Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(".submitinfo").each(function() {
- // Want to use ID as POST name
- // And value as POST value
- });
- // Submit the data
- $.ajax({
- url: 'submit.php',
- traditional: true,
- data: {
- 'submit':'true',
- 'age':$('#age').val(),
- 'loss':$('#loss').val()
- // somehow include results here
- },
- type: 'POST',
- async: false,
- success: function(data) {
- alert(data);
- },
- error: function() {
- alert('Submit Error');
- }
- });
- var data = {
- submit : 'true',
- age : $('#age').val(),
- loss : $('#loss').val()
- }
- $(".submitinfo").each(function() {
- data[this.id]=this.value;
- });
- $.ajax({
- url: 'submit.php',
- traditional: true,
- data: data,
- type: 'POST',
- async: false,
- success: function(data) {
- alert(data);
- },
- error: function() {
- alert('Submit Error');
- }
- });
- var data = {};
- $('.submitinfo').each(function() {
- var el = $(this),
- id = el.attr('id'),
- val = el.val();
- data[id] = val;
- });
- $.ajax({
- url: 'submit.php',
- traditional: true,
- data: data,
- type: 'POST',
- async: false,
- success: function(data) {
- alert(data);
- },
- error: function() {
- alert('Submit Error');
- }
- });
- $.post(url, $('form').serialize(), function(data) {
- alert("Success");
- });
Add Comment
Please, Sign In to add comment