Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidtrushkov/0f0707169771d68cc26851e5441a5058 to your computer and use it in GitHub Desktop.
Save davidtrushkov/0f0707169771d68cc26851e5441a5058 to your computer and use it in GitHub Desktop.
Simple way to submit a form. For example in ( Laravel )
//$(document).ready(function(){ <--- Or you can use this
jQuery(function($) {
$("submit").click(function(){
var $form = $(this);
//var $target = $($form.attr('data-target'));
$.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize(),
success: function(data){
// $target.html(data);
}
});
event.preventDefault();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment