bind to URL not working

shakti misra's Avatar

shakti misra

12 Mar, 2010 05:52 AM

i'm trying to use the autosuggest plugin passing a URL to get the results from. I can see the original page calling the data page but the the autosuggest doesnt pop up, the whole textarea just goes grey. I'm sure i'v got the returning JSON data from the page set up wrong. Could you please guide me in the right direction. Here's what my page is returning

{data:"Mick Jagger,Johnny Storm,Richard Hatch,Kelly Slater,Rudy Hamilton,Michael Jordan"}

What do i need to call the returned variable?

Cheers mate.

  1. 1 Posted by Charlie on 13 Mar, 2010 12:00 AM

    Charlie's Avatar

    While I don't load mine dynamically like yours, my javascript code looks like this...

  2. 2 Posted by Charlie2 on 13 Mar, 2010 12:07 AM

    Charlie2's Avatar
    var data = {items: [
    {name: "aaaa"},{name: "bbb"},{name: "cccc"}
  3. 3 Posted by Andrew on 14 Mar, 2010 11:50 AM

    Andrew's Avatar

    My json data looks like this:


    and the code to call it on is:

    $.getJSON("", function(data){
    $("input#autosuggest").autoSuggest(data.items, {selectedItem: "name", searchObj: "name", startText: "", keyDelay: 50, minChars: 1});

    Hope this helps.

  4. 4 Posted by shakti misra on 14 Mar, 2010 10:21 PM

    shakti misra's Avatar

    aaahhhh perfect! thanks andrew. that does work. but i thought when i use a URL as the first parameter in the autoSuggest plugin , it will do the .getJSON or .AJAX call . whatever it needs to do to get the data from that page. Anyhoo it works great now so pretty stocked with that. thanks guys. awesome plugin...

  5. Drew Wilson closed this discussion on 27 Mar, 2010 06:56 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac