I would like to send the form serialezed with an ajax call to beckend and parse it like with an object.
Right now i send every parameters in this way
var obj = { idSede: idSede, pickupDay: pickupDay, note: note, readyByTime: readyByTime, closeTime: closeTime };
var json = JSON.stringify(obj);
$.ajax({
url: "/ajaxCall/ajaxCall?handler=InsertDhlPickup",
method: "GET",
data: json,
success: onSuccess,
error: onError
});
But this is not confortable.
This is the serialized form, i would like to send it to backend and parse it like an object
__RequestVerificationToken=CfDJ8CHSQ74Ur15JqRlbHLgTj7GWgk4EqMBg9sxqngdoO3TlqphYf4D-ZFy7noKGvP8lJVcXbb8nAqIksnoXMJpXOwHqbCyThBGqigSWGPUJFRc_oP6z8dkGcl_cEX4As8mOVuFNWEdh3CtQccK_Ev32kDY&sedeCliente.Telefono1=030%206950238&sedeCliente.Citta=Roma&sedeCliente.Indirizzo=Via%20Cesare%201&sedeCliente.Cap=20200&sedeCliente.Provincia=RM&sedeCliente.Email=
The form is filled with razor model then in ajax post the parameter is called sedeCliente.etc then i can't create an object with the point in the name, to parse it.
Which is the best way to parse the form as an object ?
This is what i would like to have
public JsonResult OnGetInsertDhlPickup(formModel formModel){
string indirizzo = formModel.Indirizzo;