I am using the given script for auto-complete multiple values in a project. Here the code is working with the static values as given in the following script, but I want to make these values dynamic. When I try to use dynamic values in the same script, it doesn't work.
Here I am providing you the working code with static values.
<script>
$(function() {
var availableTags = [
"ActionScript", // static values start
"Ruby",
"Scala",
"Scheme" // static values end.
];
});
</script>
And here is the php code i tried to make dynamic the above script.
<?php
$recordd=mysql_query("select * from users ");
while($row22=mysql_fetch_array($recordd)):
$MessageObject[]='"' .$row22['fname']. '"';
endwhile;
$abc= implode(',<br>', $MessageObject);
?>
And now the script becomes as follow:
<script>
$(function() {
var availableTags = [
<?php echo $abc; ?> // here is the code i made dynamic. which doesn't work.
];
});
</script>
How can I solve this?