jQuery.parseJSON of an array not working

jQuery.parseJSON of an array not working

Six Months ago I started another thread about json_encoded arrays, because I was having trouble grabbing data.

That thread did give me some solutions, and until just a couple days ago I had no problems. However, now I am having problems with characters like slashes and commas. Following are the details:

Php script encoding the array
  1. echo "<td class='e'><input type='checkbox' class='Record_Chk' value='". json_encode($row_array) ."'></td>";
jQuery Script
  1.    $('.Record_Chk').click(function() {
  2.         var check = $(this).is(':checked');
  3.         var catch_array = $(this).val();
  4.         var data_row = jQuery.parseJSON(catch_array);
  5.         console.log("test: " + catch_array);    
  6.     });

For the most part output from catch_array is great. But yesterday I uploaded some contacts with job titles that have characters which are causing problems. For instance:

  • Job title: Special Assistant to the BOS & TM/Human Resource Director returns as
  • Assistant to the BOS & TM\/Human Resource Director
..... using the jQuery.parseJSON(catch_array) above.

Also ...
  • Job Title: Veteran's District Director returns as
  • Veteran
... using the jQuery.parseJSON(catch_array)

In addition - the code stops executing altogether when it runs into a '

Any assistance with this problem would be greatly appreciated.

Thanks in advance:

Pavilion