I've got an object in my javascript that keeps tracks of controls and
their values and am trying to pass it to the server to use with James
Network-King's excellent ASP.NET Json object
So it allows me to pass a JSON-d object to it and i can manipulate it
it in my VB code
Problem i am having is turning my object:
var PageData = [
{ "Tab": "Recipients", "Objects":
["Recipients_Choice","U_RoleList","U_Select"], "Values": ["","",""],
"Valid": false },
{ "Tab": "Body", "Objects":
["Subject_Text","BodyHtml_Text","BodyText_Text"], "Values":
["","",""], "Valid": false },
{ "Tab": "Schedule", "Objects":
["Schedule_Start","Schedule_End","Schedule_Frequency"], "Values":
["","",""], "Valid": false }
];
into a simple string to my use of the "getJSON" method
$.getJSON(
"modules/Schedule.ashx",
{
Mode: "Save",
Description: Description,
Data: *** The PageData object as string here ****
},
function(json) {
if (json.HasError) {
alert(json.Message);
}
else {
// Code for success here with json.Data
}
}
);
I am using this code i found (http://www.thomasfrank.se/
json_stringify_revisited.html), but when my script hits the line:
JsonString = JSON.stringify(PageData); (and then in the getJSON
call have "Data: JsonString" in the parameters
Which works.... but.... the browser hangs for like 3 seconds (and it's
not even that big of an object as you can see)
Anyone have any suggestions to "stringify" an object using alternative
methods (jQuery or even not)?