I used jquery multi select tokenizer jquery plugin from https://www.zellerda.com/projects/jquery/tokenize. I am developing a mail service in php between parents and teachers.When a parent type teachername,it needs to come in dropdown and on clicking it ,it needs to be in the textbox.When I type teachername,the console is showing parse error.When I check response,I am getting json array.Please help me.
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 .' ]';
**EDIT:**Should I need to make the response inside component??
