I'm using Typad to create an autocomplete search box and dropdown result is shown in undefined form Are there. Obviously PHP creates JSN, I have tested it. The problem may be a wrong JSON type. Here is PHP:
$ a_json = array (); $ A_json_row = array (); While ($ row = mysql_fetch_assoc ($ sql)) {// $ searchTerm = preg_replace ('/ \ s /', '+', spaces change for $ line ['products_keyword']); $ A_json_row ["search"] = $ searchTerm; $ A_json_row ["labels"] = $ line ['products_keyword']; Array_push ($ a_json, $ a_json_row); Echo json_encode ($ a_json); // back to the JSON array
and here's the script:
$ (document) .ready (function () {var keywordsVar = new Bloodhound ({DatumTokenizer : Bloodhound.tokenizers.obj.whitespace ('label'), queryTrOnizer: bluehound.tokenizers.whitespace, remote: 'keywords.php? Query =% QUERY'}); keywordsVar.initialize (); $ ('# idkeywords') Type ({signal: wrong, highlights: true, at least: 2}, {name: 'keyword', displayed: 'label', source: keywordword.atadapp ()})}}; Here is an example of JSON: [{"search": "artichoke", "label": "artichoke"}, {"search "Artichoke + 2", "Label": "Artichoke 2"}, {"Search": "Artichoke + 3", "Label": "Artichoke 3"}]
Can anyone solve this problem ??
You have a typo in the type-order declaration, it is displayKey
Should be with the ones.
here one
No comments:
Post a Comment