I am using jquery Ajax to post form values. Is there a way to add values dynamically ? This code doesn't work:
MY_APP_LOGIN.loginFormAttachEvent = function () {
$( "#login" ).unbind('submit').removeAttr('onsubmit').on('submit', function(event) {
var values = $( this ).serializeArray();
var o = { foo: 'bar' };
//o.pageKey = MY_APP_NAV.CMS_PAGE_KEY;
values.push(o);
$.ajax({
type : 'POST',
url : '/user/loginajax',
data : values,
dataType : "json",
});
}
return false;
});