I've got a collection that does a url request,
class Movieseat.Collections.Moviesearch extends Backbone.Collection
url: ->
"http://api.themoviedb.org/3/search/movie?api_key=a8f7039633f2065942cd8a28d7cadad4&query=#{@query}"
setQuery: (q) ->
@query = q
return
I've got a view that renders a template, in the template is a input field. When text is typed in the input field the Collection gets updated with the value and when there's a keyup action in the input field the collection gets fetched.
class Movieseat.Views.Moviesearch extends Backbone.View
template: JST['movieseats/moviesearch']
el: '#moviesearch'
initialize: (opts) ->
{@collection} = opts
@render()
return
render: ->
$(@el).html(@template())
return
events:
"keyup input": "doSearch"
doSearch: (e) ->
inputtext = @$("form#autocomplete-remote input").val()
console.log inputtext
@collection.setQuery $(e.currentTarget).val()
@collection.fetch()
And now I'm trying to render each result in a li element, but I don't know how to do that. What would be the next step for me?