Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unexpected non-whitespace character after JSON data #29

Open
holden opened this issue Nov 18, 2012 · 1 comment
Open

unexpected non-whitespace character after JSON data #29

holden opened this issue Nov 18, 2012 · 1 comment

Comments

@holden
Copy link

holden commented Nov 18, 2012

SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data
[Break On This Error]

this.options.itemSelected(JSON.parse($selectedItem.attr('data-value')));

Bootstrap 2.2.1

    $('#q').typeahead
      source: '/admin/search.json'
      val: '_id'
      #tmpl: _.template("<li id=\"<%= _id %>\"><a href=\"/admin/reviews/<%= _id %>\"><%= name %>, sdfsdf<%= reviewable_type %></a></li>")
      minLength: 3
      itemSelected: ->
        alert "Congratulations you used everything!"

When I try to use the template, I can see the URL links are correct but when I click it, I get the same error and no redirect.

json

[{"_id":"4f956b76d97ab00001000027","reviewable_type":"City","name":"Krak\u00f3w"},{"_id":"4ff94b8725b1a80001000006","reviewable_type":"Place","name":"Bomba"},{"_id":"4fe056caa9e05f0001000030","reviewable_type":"Place","name":"Singer"},{"_id":"50a8286ddced86b247000014","reviewable_type":"Place","name":"Burgermeister"},{"_id":"4fddff698fdfdf0001000009","reviewable_type":"Place","name":"Miejsce"},{"_id":"4f7efda4a660a20001000022","reviewable_type":"Place","name":"Plan B"},{"_id":"4f8c506018e6d3000100000a","reviewable_type":"Place","name":"Propaganda"},{"_id":"4fe188af4e8f460001000007","reviewable_type":"Place","name":"Alebriche"},{"_id":"4f7ec8231c3f30000100002d","reviewable_type":"City","name":"Montreal"},{"_id":"5011352f6f98860002000004","reviewable_type":"Place","name":"Charlotte: Chleb i Wino"}]
@pashazel
Copy link

+1
jquery 1.8.3
Bootstrap 2.2.2

if you remove the check
if (typeof that.options.val === 'string') (l 175)
it will work. sorry for my english

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants