Possible Duplicate:
How do I use jQuery’s form.serialize but exclude empty fields
I would like to send all values from fields in a form using ajax without value from field “lastname” – how can I do that? My code:
<script>
$(document).ready(function () {
$('#other').click(function () {
$.post("/Home/About", $("#target").serialize());
});
});
</script>
<form id="target" action="/Home/About" method="post">
First name:
<input type="text" name="firstname" id="firstname"><br>
.....other fields.....
Last name:
<input type="text" name="lastname" id="lastname"><br>
</form>
<div id="other">Submit</div>
You can use the
:notselector: