"Jokes API": PATCH a joke (with jwt-auth)


// Javascript code to send token to API:
    // see http://malsup.com/jquery/form/ for info about ajaxForm()
        beforeSend: function(request){
            // set token in header
            request.setRequestHeader('Authorization', 'Bearer ' + localStorage.token);
        dataType:  'json',
        success: function(data) {
            // Decode and show the returned data nicely. See http://t4t5.github.io/sweetalert/ for info of swal()
            swal("API response:\n"+JSON.stringify(data));
        error: function(data) {
            swal({ html:true, title:'Error', text:JSON.stringify(data)+"

When receiving eror 'token_not_provided', first run: 'Demo getting & storing token clientside'"}); //document.getElementById("body").innerHTML = JSON.stringify(data); } }); });



Westerpark, Amsterdam, Netherlands

Send an e-mail