Skip to content

Instantly share code, notes, and snippets.

@MyklClason
Created August 18, 2019 03:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MyklClason/71f26ea74ddfcf6c5f51e77582796d50 to your computer and use it in GitHub Desktop.
Save MyklClason/71f26ea74ddfcf6c5f51e77582796d50 to your computer and use it in GitHub Desktop.
Rails AJAX call
// Note: Must use `var self = this` to access stuff within the success/error functions
Rails.ajax({
url: action_path,
type: "PATCH",
data: $.param(data),
dataType: 'script',
processData: false,
contentType: false,
success: function(data) { },
error: function(data) { }
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment