Skip to main content

Search and Top Navigation

#7230 closed bug (worksforme)

Opened April 09, 2011 06:11AM UTC

Closed April 09, 2011 07:52AM UTC

jquery ui.autocomplete

Reported by: piranus Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.autocomplete Version: 1.8.11
Keywords: Cc:
Blocked by: Blocking:
Description

jquery version 1.5.1

jquery.ui version 1.8.11

try simple source as file

the result from source won't show up under input box

but if copy the json data from source as place in as a var

it will work

software working with 1.8.7 but not work with 1.8.11

Attachments (0)
Change History (1)

Changed April 09, 2011 07:52AM UTC by rdworth comment:1

resolution: → worksforme
status: newclosed

Ensure your JSON is 100% valid. This wasn't a requirement of jQuery 1.4+ (which is bundled with jQuery UI 1.8.7, even up to 1.8.10) but it is a requirement of jQuery 1.5+ (bundled starting with jQuery UI 1.8.11). A few common ways people get tripped up with invalid JSON are

  • not quoting keys
  • using single-quotes instead of double-quotes around either keys or string values
  • having an extra (trailing) comma in an object or array

While these may be accepted in many instances in JavaScript object literal notation (of which JSON is a subset) they are errors for a validating JSON parser like the one in jQuery 1.5+. I also suspect this is why it works when you put it in a var, because then you no longer have JSON, you have JavaScript object literal notation.

More info:

If you find your JSON is 100% valid and still have an issue, please post a minimal sample page using http://jsfiddle.net/ ( click on Testing Ajax Requests or see http://jsfiddle.net/rdworth/EBduF/ for a sample)