I have a set 开发者_高级运维of checkboxes with multiple choice allowed. I parse the set this way:
if ($("input[name='route_day']:checked").length > 0) {
$("input[name='route_day']:checked").each(function(){
if(this.value != null)
route_days_hook.push(this.value);
});
dataTrap.route_days = $.JSON.encode(route_days_hook);
}
...and pull the whole dataTrap
to an AppEngine Python script via jQuery ajax. However, the Python script just bugs. If i change dataTrap.route_days
value to a string instead of the JSON encoded object, everything works fine.
have you tried:
dataTrap.route_days = $.parseJSON(route_days_hook);
EDIT
if that didn't work, maybe it's because you are trying to convert an array object to JSON...
try this solution instead.
精彩评论