0

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.
My question is: how can i pass a checkbox set to the script using Ajax and still be able to iterate over it on the script?

Jorge Guberte
  • 10,464
  • 8
  • 37
  • 56

1 Answers1

1

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.

Community
  • 1
  • 1
Reigel Gallarde
  • 64,198
  • 21
  • 121
  • 139