I'm using the following code in an attempt to add a new attribute to bar object:
$(document).ready(function(){
$('form').on("submit",preventDefault);
});
function preventDefault(e) {
e.preventDefault();
$url="contact/send";
bar = $('form').serialize();
bar["foo"]='xyz';
//bar.foo="123";
console.log(bar);
}
However I don't ever seem to get the value of bar.foo. If I look at the console in Chrome I always get a result similar to this:
name=Grahame&email=foo%40bar.com&message=Hello.
Why am I not getting the value/property of foo?