I have a JSON object in jquery like this :-
userObj =
{
"loginId":"abc123",
"class":"5",
"email":"[email protected]",
"level":"1"
}
I have to send a POST request to the server with multipart/form-data. I have created a FormData object :-
var fd = new FormData();
What I need to do is to iterate over each element in the JSON and append them to my variable fd. This is what I want :-
fd.append('loginId','abc123');
fd.append('class',5);
fd.append('email','[email protected]');
Any idea how to achieve this?