How to convert an object to the serialized syntax for data in jquery.ajax function?
Posted
by
Matthew
on Stack Overflow
See other posts from Stack Overflow
or by Matthew
Published on 2011-01-17T20:44:36Z
Indexed on
2011/01/17
20:53 UTC
Read the original article
Hit count: 426
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"
}
]
© Stack Overflow or respective owner