How to convert an object to the serialized syntax for data in jquery.ajax function?
- by Matthew
I have an object that I want to send with my jquery.ajax function but I can't find anything that will convert it to the serialized format I need.
$.ajax({
type: 'post',
url: 'www.example.com',
data: MyObject,
success: function(data) {
$('.data').html(data)
}
})
MyObject = [
{
"UserId": "2",
"UserLevel": "5",
"FirstName": "Matthew"
},
{
"UserId": "4",
"UserLevel": "5",
"FirstName": "Craig"
}
]