Skip to content

Instantly share code, notes, and snippets.

View melanyss's full-sized avatar
🚀
Building awesome projects

Melanys melanyss

🚀
Building awesome projects
View GitHub Profile
@melanyss
melanyss / jquery.snippets.js
Created November 16, 2020 11:43 — forked from avireni/jquery.snippets.js
Jquery + JS snippets
Check if and which key was pressed
$(function() {
$(document).keypress(function(e){
switch(e.which){
// "ENTER"
case 13:
alert('enter pressed');
break;
// "s"
@melanyss
melanyss / Jquery Ajax
Created November 21, 2020 16:21 — forked from JonnyNineToes/Jquery Ajax
Quick template for Jquery Ajax calls
// submit is an action performed ON THE FORM ITSELF...
// probably best to give the form an ID attribute and refer to it by that
$('form').submit( function (event) {
// prevent the usual form submission behaviour; the "action" attribute of the form
event.preventDefault();
// validation goes below...
// now for the big event
$.ajax({
// the server script you want to send your data to