Hi, I use this function to submit my post requests. But now I have a problem with radio buttons and checkboxes. It sends all button values to server, so the last radio buttons' (even it's not checked) value passes as value. checkboxes are same, even it's not checked, it sends checked value.
$("form#profile_form").submit(function() { $("#users_profile h1").after('<div class="loading"></div>'); $("#users_profile .errors").remove() var inputs = []; $(':input', this).each(function() { inputs.push(this.name + '=' + unescape(this.value)); }); $.ajax({ type : "POST", data : inputs.join('&'), url : "tasks.php?task=updateprofile", success : function(msg) { $("#users_profile .loading").remove(); if(msg == "ok") { $("#profile_form").remove(); $("#users_profile h1").after('<div class="message m_info">Profile updated!</div>'); } else { $("#users_profile h1").after(msg); } } }); return false; });