Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //ROUTES DON'T FORGET TO DO RAKE ROUTES BEFORE RELOADING!
- post 'participants/GetParticipant' => 'participants#GetParticipant'
- //CONTROLLER
- //PUT THAT LINE JUST AFTER YOUR BEFORE ACTION
- skip_before_action :verify_authenticity_token,only: [:GetParticipant]
- //THEN DO YOUR FUNCTION
- def GetParticipant
- participant = Participant.last
- puts participant.to_s
- render :json => {data:participant}
- end
- //JAVASCRIPT OF YOUR GAME
- function GetParticipant(){
- $.ajax({
- url: "/participants/GetParticipant",
- type: 'post',
- complete: function(data){
- console.log(data);
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement