Splitting values to re-store the ID back into the database.

benlittle1991's Avatar

benlittle1991

04 Aug, 2011 07:56 PM

Hey guys,

I've finally got the AutoSuggest to work, It successfully gets the data from the database and then shows it in the search (limited to 3 results)

My problem is, I dont know how to access these 3 values (could be 1,2 or 3) and then store them as 3 variables (if 2 are chosen, the 3rd value would be NULL).

I checked the comments and found this:
'var arr = $(".as-values").val().split(",");'

I have 2 columns the query gets, one is the category_id, which is 'value' and the second one is name which is 'name'.

I'm not sure how to use this? Wil the '".as-values"' have to match the ID column? so this should be renamed to '".value"'

Any help would be kindly appreciated and if possible, with code examples.

  1. 1 Posted by benlittle1991 on 17 Aug, 2011 06:44 PM

    benlittle1991's Avatar

    Any help would be greatly appreciated.

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