Tom Worster wrote:
> 
> what autocomplete plugin are you using? this one does not have a documented
> "parse" option: 
> http://docs.jquery.com/Plugins/Autocomplete/autocomplete#url_or_dataoptions

Its the standard autocomplete plugin available at
http://docs.jquery.com/Plugins/Autocomplete

I found the syntax for handling json data in it on another web page.

> 
> two more points, though i don't know if they make any odds:
> 
> it seems to be more conventional jq style (see
> http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery) to put all
> your jq script inside  a block like this:
> 
>  $(document).ready(function() {  });

I'm going to need to be able to call the autocomplete setup function
again later so I pulled it into a separate function.

> and is there a reason to prefer:
>   $(".author_name").each(function (i) { $(this).autocomplete(); });
> over
>   $(".author_name").autocomplete();
> ?

This was me struggling to figure out what was wrong with my code, which
I did figure out this morning.  I've removed the call to 'each'.

And now for the solution to my problem.  This bit of js:

  var searchurl = $("#authsearch_url").attr("href");

extracts the url I'm giving to autocomplete from the web page, allowing
me to use my templating system to set that URL.  Idiot me failed to
include that html fragment in the 2nd page, where I edit a paper,
therefor causing autocomplete to fail because it had a bad url.

Once I realized my error it was the work of a moment to correct things
and get autocomplete working properly.

--[Lance]


-- 
 GPG Fingerprint: 409B A409 A38D 92BF 15D9 6EEE 9A82 F2AC 69AC 07B9
 CACert.org Assurer

Reply via email to