jquery 分词器中 json 响应的解析错误

Parse error for json response in jquery tokenizer

我使用了 jquery multi select tokenizer jquery 来自 https://www.zellerda.com/projects/jquery/tokenize 的插件。我正在 php 中 parents 和 teachers.When 之间开发一个 parent 类型的教师姓名的邮件服务,它需要出现在下拉菜单中,点击它时,它需要出现在textbox.When 我输入教师姓名,控制台显示解析 error.When 我检查响应,我正在 json array.Please 帮助我。

Jquery:

<link rel="stylesheet" type="text/css" href="../js/jquery_multipleSelect/jquery.tokenize.css" />
<script type="text/javascript" src="../js/jquery_multipleSelect/jquery.tokenize.js">
</script>

$('#to_message').tokenize({
    datas: "module/parents/communication/view_teacher_search.php?action=new_message",
    contentType: "application/json; charset=utf-8",//not working when commented
    //dataType: "json",//without commented also not working
    autosize: true,
    nbDropdownElements: 30,
    onAddToken: function(value, text, e){
        $( "#compose_message" ).append( '<input type="hidden" name="teacher_ids[]" id="'+value+'" value="'+value+'" >' );
    },
    onRemoveToken: function(value, e){
        $( "#"+value ).remove();
    }
});

view_teacher_search.php

 $db->query($getStudentsListQuery);
//$selStudents = '';
    while($row = $db->get_row())
   {                    
    $data .=   ' {
                    "text" : "' .$row[1] . ' - '. $row[2] .' - ['. $row[3] .']",
                    "value" : "'.$row[0].'"
                },';
    if($action == 'reply_message'){
        break;    
    }
   } 
  $new_userdata = substr_replace($data,"",-1); 
  echo '[ '. $new_userdata .' ]'; 

**编辑:**我需要在组件内部做出响应吗??

问题是每个文字反斜杠都需要使用另一个反斜杠进行转义

\ 变成 \\

"text" : "Abdul Hakim - Hamed - [Language and literature \ Arabic]",