chaitu chaitu
asked on
how to construct below json object and send it to server
HI,
I have a form in the frond end.how to construct below json object like below and send it to server
prepareJSON={"address":{"a ddressId": 1,"address Name":"New York"},"fi rstName":" John","hir eDate":"21 -Oct-2008" ,"lastName ":"Abraham ","salary" :"1000"}
I have a form in the frond end.how to construct below json object like below and send it to server
prepareJSON={"address":{"a
var addressId = $("#addressId").val();
var addressName = $("#addressName").val();
var firstName = $("#firstName").val();
var hireDate = $("#hireDate").val();
var lastName = $("#lastName").val();
var salary = $("#salary").val();
prepareJSON={};
prepareJSON["address"] = {"addressId":addressId,"addressName":addressName};
prepareJSON["firstName"] = firstName;
prepareJSON["hireDate"] = hireDate;
prepareJSON["lastName"] = lastName;
prepareJSON["salary"] = salary;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://stackoverflow.com/questions/1184624/convert-form-data-to-js-object-with-jquery