I'm trying to turn form inputs into an array (input names as keys and values as values) inside of jquery using serializeArray()... then pass it to a php script via $jquery.ajax.. using the post method.
$(function () {
$("#xbut").click(function () {
var values = {};
$.each($(':input').serializeArray(), function (i, field) {
values[field.name] = field.value;
});
$.ajax({
type: "POST",
url: 'ajax/NewClient.php',
data: {
clientdata: values
},
success: function (data) {
alert(data);
}
});
return false;
});
});
i had this working last night... but made some changes and now can't revert. when i use the array conversion for data... i cannot find $_POST['clientdata'] in the NewClient.php.. it just isn't defined. If I change my ajax data into a string... i can find whatever i post.
Any ideas?