{"id":1831,"date":"2022-08-30T15:19:48","date_gmt":"2022-08-30T15:19:48","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/12\/02\/jquery-remote-autocomplete-callback-error-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:19:48","modified_gmt":"2022-08-30T15:19:48","slug":"jquery-remote-autocomplete-callback-error-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/jquery-remote-autocomplete-callback-error-collection-of-common-programming-errors\/","title":{"rendered":"jQuery remote autocomplete callback error-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;ve got a tricky problem here. Using jQuery mobile autocomplete to query the LinkedIn companies API, I see this error in my console:<\/p>\n<pre><code>Uncaught TypeError: Property 'callback' of object [object Object] is not a function  (anonymous function)\n<\/code><\/pre>\n<p>It&#8217;s inconsistent. Sometimes it doesn&#8217;t show up and I see the right search results. But it does appear when the immediate query term isn&#8217;t return any results (even if I am in the middle of typing a query).<\/p>\n<p>I know I&#8217;m at least receiving the right results somewhere because I see them in my Chrome dev tools, but when the above error pops up in my console, the most recently updated search results don&#8217;t show up in my browser. For example, typing in &#8220;BlackRock&#8221; returns the appropriate search results from LinkedIn in a jsonp object (though NOT in my browser):<\/p>\n<pre><code>callback({\n  \"companies\": {\n    \"_count\": 10,\n    \"_start\": 0,\n    \"_total\": 91,\n    \"values\": [\n      {\n        \"id\": 4764,\n        \"name\": \"BlackRock\"\n      },\n      {\n        \"id\": 405075,\n        \"name\": \"DSP BlackRock Mutual Fund\"\n      },\n      {\n        \"id\": 2289863,\n        \"name\": \"Blackrock Search Ltd\"\n      },\n      {\n        \"id\": 2766517,\n        \"name\": \"Blackrock Lender Services\"\n      }\n...\n<\/code><\/pre>\n<p>These are what I SHOULD be seeing in my browser. The results I see in my browser are these (apparently results for &#8220;Black&#8221;):<\/p>\n<pre><code>callback({\n  \"companies\": {\n    \"_count\": 10,\n    \"_start\": 0,\n    \"_total\": 10122,\n    \"values\": [\n      {\n        \"id\": 2845927,\n        \"name\": \"BeatingJack\"\n      },\n      {\n        \"id\": 758374,\n        \"name\": \"Black Book\"\n      },\n      {\n        \"id\": 3042437,\n        \"name\": \"Wine in Black GmbH\"\n      }\n...\n<\/code><\/pre>\n<p>It seems that the &#8216;in-between&#8217; query &#8220;blackro&#8221; is what&#8217;s throwing things off, because it returns no results in the json object:<\/p>\n<pre><code>callback({\n  \"companies\": {\"_total\": 0},\n  \"facets\": {\n    \"_total\": 1,\n    \"values\": [{\n      \"buckets\": {\"_total\": 0},\n      \"code\": \"location\",\n      \"name\": \"Location\"\n    }]\n  },\n  \"numResults\": 0\n})\n<\/code><\/pre>\n<p>My autocomplete code is long, but these are some of my settings:<\/p>\n<pre><code>          dataType: 'jsonp',\n          jsonpCallback: \"callback\",\n          cache: true,\n          jsonp: false,\n<\/code><\/pre>\n<p>I&#8217;ve tried to wrap all of my code in a <code>callback<\/code> function, but no success. Any ideas?<\/p>\n<p id=\"rop\"><small>Originally posted 2013-12-02 20:56:37. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve got a tricky problem here. Using jQuery mobile autocomplete to query the LinkedIn companies API, I see this error in my console: Uncaught TypeError: Property &#8216;callback&#8217; of object [object Object] is not a function (anonymous function) It&#8217;s inconsistent. Sometimes it doesn&#8217;t show up and I see the right search results. But it does appear [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1831","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1831","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1831"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1831\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1831"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1831"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1831"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}