Skip to main content
Nov 14, 2013 5:43 PM UTC
Answered

Jquery autocomplete with json

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 is closed to new replies. Start a new post to keep the conversation going.
    tribuleCorrect answer
    Legend
    Nov 19, 2013 7:51 AM UTC

    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>

    13 replies

    Nov 14, 2013 5:56 PM UTC

    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" />

    Translate
    Legend
    Nov 15, 2013 4:01 PM UTC

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

    Translate
    Nov 17, 2013 2:55 AM UTC

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

    Translate