echo '<a onclick="load_tags('.$list['id'].')"></a>'
when list[id]
is a number, it works. but when list[id]
is a word, it does not work. why?
below is some background on the function and what i am doing. although it is not necessary for the purposes of answering this question.
script
function load_tags(id){
$.post('../php/tags/get_tags.php',{id:id},function(data){
$('#tags_selected').text(data);
});
}
get_tags.php
$tag_id=$_POST['id'];
echo $tag_id;
$users_with_this_tag=show_all_users_with_this_tag($tag_id);
if(count($users_with_this_tag)!=0){
foreach($users_with_this_tag as $key => $list){
echo $list['user_id'];
}
}else{
echo'Nobody with this tag';
}