YesNoOk
View in topic context
15 Replies
May 24
2013

Re: User tagging

May 24, 2013, 17:24:13 | by Suki
Well, thats as far as I could go really, the script itself fires up an ajax call everytime the user types the @, thats cool for simple queries to text files or simple demo pages but for something real like a forum userbase thats just not possible as it would kill the server. Thats why I end up wrapping the ajax call to be fire up only on focus() , that alone drastically reduced the number of ajax request the script does, the retrieved data gets appended to the DOM so all the sorting and juggling are done on client side which is really a nice plus to have.

I certainly don't know how can it be optimized and I only had tested it on local and on my site so I still don't know how it will behave with a large userbase. The things I did to minimize server hits were based upon assumptions and common sense :P

What was really nice is that the script lets you output the data back to the textarea in any way you want, I chose this format because that was an easy way to get the data with regex but I know I could write the data back in a fancy and more stylish way like @username and pass the real data on some hidden post var then do the replace on parsing.

I tried the SMF autosuggest feature, perhaps it was me but I didn't find it easy to customize and besides it wasn't designed to work on textareas.