oakmac / autocompletejs

AutoCompleteJS Widget
Other
72 stars 14 forks source link

Allow means to preprocess data before it is parsed #77

Closed chipseraphine closed 11 years ago

chipseraphine commented 11 years ago

The preProcess ajaxOpt assumes that your ajax call hits a valid JSON file. It would be useful to have a variant of preProcess that actually ran previous to all processing-- i.e. feed it the raw content from the HTTP call. This would allow options lists to be built from simple text files or other arbitrary sources that would currently generate a parseerror.

oakmac commented 11 years ago

You should be able to control this with the ajaxOpts property.

Try this:

ajaxOpts: {
  dataType: "text"
}
chipseraphine commented 11 years ago

Excellent! I wasn't aware of that. This solves my problem nicely, and thanks for the quick response.

I know the ajax functionality is largely external, but some hints for how to talk to it in the (otherwise excellent!) docs would be appreciated.

oakmac commented 11 years ago

Definitely; I've been wanting to add a few more AJAX examples demonstrating this kind of thing.