Skip to main content
November 14, 2013
Answered

Jquery autocomplete with json

  • November 14, 2013
  • 1 reply
  • 4254 views

Does anyone have a full working example of Jquery autocomplete with json that works?

I can't get any of the examples that I am finding online to work.

    This topic has been closed for replies.
    Correct answer tribule

    I think my data is in the wrong format. Here is my response:

    //"\/\/[\"Miami Area Geriatric Education Center\",\"Miami Children's Hospital\",\"Miami Research Associates\",\"Miami University (Oxford, Ohio)\",\"Miami Valley Hospital\",\"Miami, FL-546\",\"University of Miami\\\/Jackson Health System\"]"


    The ongoing thread here http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:64866 is really saying the same thing you and I are, namely that the data is not in the correct format (as you know). That thread made mention to this article: http://www.petefreitag.com/item/720.cfm. The leading "//" on the front of that data shows that secure JSON is enabled. This "//" prefix needs to be removed from the data. Can you put this in your code to turn secure JSON off and then see what response you get?

    <cfset this.secureJSON = false>

    1 reply

    November 14, 2013

    I have the following code that doesn't work. But when I browse the CFC is works perfectly. Thoughts?

    <script type="text/javascript">

    $(function() {

        $("#searchPhrase").autocomplete({

            source: "/contentfiles/ajaxlookup.cfc?method=getInstitutions&returnformat=json"

        });

    });

    </script>

       

    category: <input id="searchPhrase" />

    Legend
    November 15, 2013

    Please define "doesn't work". Put your code online somewhere so that we can see it running.

    November 17, 2013

    It doesn't bring back any records. But if I browse the CFC it works.