crowdint/rails3-jquery-autocomplete — pull request #217 by whatcould (2013-03-22 12:44:09+00:00)
Title: Do not parseJSON on empty data-update-elements [fixes #210]

This fixes an issue that is apparently related to jQuery 1.9's parseJSON (which calls the native function if available); if called without input, eg `window.JSON.parse()`, it returns the somewhat strange, `SyntaxError: Unexpected token u`, or in Firefox, `SyntaxError: JSON.parse: unexpected character.

Anyway, if the data-update-elements attribute is not there, the autocomplete code was passing `undefined` to parseJSON when leaving the field (onchange). Which triggers these strange javascript errors.

fyi, the workaround for the issue is to add `update_elements: {}` to your element (formtastic would be: `input_html: {update_elements: {}}`).