Skip to content

Instantly share code, notes, and snippets.

@codepainkiller
Created October 29, 2015 21:07
Show Gist options
  • Save codepainkiller/9bf374f5363131bce5f4 to your computer and use it in GitHub Desktop.
Save codepainkiller/9bf374f5363131bce5f4 to your computer and use it in GitHub Desktop.
$.ajax({
url: 'http://mydomain.com/ajax-request',
type: 'POST',
dataType: 'json',
async: true,
data:{
'_token': '{{ csrf_token() }}',
'foo' : 'Foo'
},
success: function success(data, status) {
console.log(data);
alert(data);
},
error: function error(xhr, textStatus, errorThrown) {
alert('Remote sever unavailable. Please try later');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment