remote source issue

darf's Avatar

darf

04 Apr, 2013 11:28 PM

Hey guys,
finally thanks to some great posts here I've managed to get this plugin working but still have a important issue. I testing scripts on localhost and would like to supply the search list dynamically by certain php queries.
My code is simple:
var data = {items: [{"value": "polska", "name": "polska"},{"value": "ukraińska", "name": "ukraińska"} ]};

$(document).ready(function() { $("#kuchnia").autoSuggest(data.items, {minChars: 2, matchCase: false, selectedItemProp: "name", selectedValuesProp: "value", searchObjProps: "name"}); })

in this case everything is ok. but when I try to supply field externally like this:

$(document).ready(function() { $("#kuchnia").autoSuggest("http://localhost/admin.php?data=kuchnia", {minChars: 2, matchCase: false, selectedItemProp: "name", selectedValuesProp: "value", searchObjProps: "name"}); })

nothing can be found (script not working). output from http://localhost/admin.php?data=kuchnia is the same as in data.item (actually I copied result of this link so the json seems to be ok). any ideas why it's not working?
localhost is ok as site is on localhost.

regards and thx for help in advance :)
m.

  1. 1 Posted by yogi_rrn on 24 May, 2013 01:40 PM

    yogi_rrn's Avatar

    For passing query string parameter use property "queryParam".
    Default parameter is defined is "q".

    $("#kuchnia").autoSuggest("http://localhost/admin.php", { minChars: 2,
    matchCase: false,
    selectedItemProp: "name",
    selectedValuesProp: "value",
    searchObjProps: "name",
    queryParam: "data" }); })

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? 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