I am working on a Rails project and try to use $.post to get some data from the server, but nothing happens. Does anyone see whats wrong?
HTML File
<a id="ta" role="button" class="btn">tzt</a>
<div id="ggg">Code goes here</div>
.js file
$ ->
$('#ta').click (e) ->
e.preventDefault()
$.post "/hype", (data)
$("#ggg").html data
routes.rb
match '/hype', to: 'items#xxx'
controller.rb
def xxx
@item = Item.last
return render :text => "New Text"
end
The .js file should be as such
Need the function call after the post