Skip to content

Instantly share code, notes, and snippets.

@mbbx6spp
Last active October 20, 2024 14:30
Show Gist options
  • Save mbbx6spp/365144 to your computer and use it in GitHub Desktop.
Save mbbx6spp/365144 to your computer and use it in GitHub Desktop.
jQuery API usage example in CoffeeScript translated to Javascript.
# Creative Commons Attribution-Share Alike 3.0 United States License
# http://creativecommons.org/licenses/by-sa/3.0/us/
# By Susan Potter <https://www.susanpotter.net/software/>
(($) ->
editSubmitHandler: (evt) ->
form: $(this)
data: form.serialize()
url: form.attr('action')
$.getJSON(url, data, (data, resp) ->
$('#notice').html(data['html'])
)
$('#editForm').submit(editSubmitHandler)
) jQuery
// Creative Commons Attribution-Share Alike 3.0 United States License
// http://creativecommons.org/licenses/by-sa/3.0/us/
// Generated from CoffeeScript translator of previous CS code.
(function($) {
var editSubmitHandler;
editSubmitHandler = function editSubmitHandler(evt) {
var data, form, url;
form = $(this);
data = form.serialize();
url = form.attr('action');
return $.getJSON(url, data, function(data, resp) {
return $('#notice').html(data['html']);
});
};
return $('#editForm').submit(editSubmitHandler);
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment