Skip to content

Instantly share code, notes, and snippets.

View Luizgpp's full-sized avatar
🎯
Focusing

Luiz Gabriel Parreira Pereira Luizgpp

🎯
Focusing
  • DDMX - Produtividade Inteligente
  • Itajuba
View GitHub Profile
Carrinho = {
add: function addCarrinho(url) {
$.ajax({
type: "GET",
url: url,
data: "",
success: function() {
$('.cart-total').load(document.URL + " .cart-total ul");
}
});
@Luizgpp
Luizgpp / bugajax.js
Last active September 20, 2016 23:16
// create post
$('form#form-post').on("submit", function(e){
e.preventDefault();
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use Session;
@Luizgpp
Luizgpp / laravel.js
Created September 1, 2016 05:12 — forked from soufianeEL/laravel.js
You use Laravel 5 and you want to send a DELETE request without creating a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. To use, import script, and create a link with the `data-method="DELETE"` and `data-token="{{csrf_token()}}"` attributes.
/*
Exemples :
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}">
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}" data-confirm="Are you sure?">
*/
(function() {