Posts

Showing posts with the label jquery-tokeninput

JQuery tokeninput: [Error] TypeError: undefined is not an object (evaluating 'term.replace')

JQuery tokeninput: [Error] TypeError: undefined is not an object (evaluating 'term.replace') I'm using http://loopj.com/jquery-tokeninput/ because I needed to interface a select box directly to DB. I wrote the PHP script that accept GET request like explained on his GitHub: <?php require_once('sondaggio.php'); # Connect to the database $s = new Sondaggio(); # Perform the query $query = sprintf("SELECT id, nome from Regioni WHERE nome LIKE '%s%' LIMIT 5", $s->getRealEscapeString($_GET["q"])); $arr = array(); $arr = $s->readFromDB($query); # JSON-encode the response $json_response = json_encode($arr); # Return the response echo $json_response; ?> Class Sondaggio constructor: function __construct(){ $this->conn = new mysqli($this->host, $this->user, $this->password, $this->database); // Check connection if ($this->conn->connect_error) { exit("Connection failed: " . $this->conn...