I wander how send post form data in json format via ajax with JQuery dynamically?
For example I’m coding something like this in JQ:
$.post("test.php", { func: "getNameAndTime" },
function(data){
alert(data.name); // John
console.log(data.time); // 2pm
}, "json");
and that’s good, but in live apps often need to send huge form data and user can dynamically change the fields, so I don’t know how many func1, func2, func3 or even func[] will be sent.
The q is how to do this dynamically, in old world of an AJAX I could done it by serealizing the form and send to the server.
Thanx in advance.
Yes I can send all the data to the server and in any case it will worked well,
example:
});