Created
April 2, 2016 03:44
-
-
Save osiro/9e88cf69c9c8c3f40362dd0de857cef4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TrackingsController < ApplicationController | |
def create | |
@tracking = Tracking.create(tracking_params) | |
render json: { success: true } | |
end | |
private | |
def tracking_params | |
params.require(:tracking).permit(:ip, :url) | |
end | |
end |
Author
osiro
commented
Apr 2, 2016
$('a').click (e) ->
# exemplo: "http://www.icasei.com.br/sobre"
url = e.currentTarget.href
$.ajax
url: '/trackings'
method: 'POST'
data:
tracking:
ip: url
$('a').click(function(e) {
var url = e.currentTarget.href;
$.ajax(url: '/trackings', method: 'POST', data: { tracking: { ip: url } });
});
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment