Created
February 7, 2019 17:23
-
-
Save zymawy/fb9fc8332137e5606154b4505dd2d3ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function(){ | |
jQuery('#submit').click(function(e){ | |
e.preventDefault(); | |
jQuery.ajaxSetup({ | |
headers: { | |
'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') | |
} | |
}); | |
jQuery.ajax({ | |
url: "{{ url('/form') }}", | |
method: 'post', | |
data: { | |
name: jQuery('#footballername').val(), | |
type: jQuery('#club').val(), | |
price: jQuery('#country').val() | |
}, | |
success: function(data){ | |
jQuery.each(data.errors, function(key, value){ | |
jQuery('.alert-danger').show(); | |
jQuery('.alert-danger').append('<p>'+value+'</p>'); | |
}); | |
} | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment