Skip to content

Instantly share code, notes, and snippets.

@rustedgrail
Last active April 8, 2016 15:28
Show Gist options
  • Save rustedgrail/48095edf0f1b4f68a557139496981ea6 to your computer and use it in GitHub Desktop.
Save rustedgrail/48095edf0f1b4f68a557139496981ea6 to your computer and use it in GitHub Desktop.
var SearchForm = Frame.createClass({
render: function() {
return (
<input id="search-box" type="text" />
<input id="search-button" type="button" />
)
}
});
var SearchResults = Frame.createClass({
events: [{
selector: "#input-box",
trigger: "change",
effect: function(event) {
this.setState({searchValue: event.target.value})
}
}, {
selector: "#input-button",
trigger: "click",
effect: function() {
$.ajax("/model?query=" + event.target.value).then(function(data) {
// insert data to search results
})
}
}],
render: function() {
return (
// something that holds search results
);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment