vendredi 20 janvier 2017

Ajax individual Proces

i have a individual button in each row to my function, what i want is, when i click my button change the button to refres icon, just for the button in the row i click, but when i try to restart all row change to refres. in my program i use ajax, can someone help me? maybe give me some advice, or tecnology to do what i want thank. Soo need help i cant fount answear i want in google. :(

   var rows = mainTable.row($(this).parents('tr'));
    $.ajax({
        type: "POST",
        dataType: "jsonp",
        url: url+'='+job,
        beforeSend:function(){
            rows.$("#showFa").hide();
            rows.$("#hideFa").show();
        },
        complete: function (XMLHttpRequest, xhr, jqXHR, textStatus, response) {
            waitingDialog.hide();
            rows.$("#showFa").show();
            rows.$("#hideFa").hide()
            console.log("TESTTT"+XMLHttpRequest.status);
            if (XMLHttpRequest.status == "200") {
                alert(XMLHttpRequest.status + " " + url+'='+job);
                mainTable.ajax.reload();
                $.toast().reset('all');
                $("body").removeAttr('style');
                $.toast({
                    heading: 'Restart Job Success',
                    text: response,
                    position: 'buttom-right',
                    preventDuplicates: 'false',
                    loaderBg:'#4c7fff',
                    icon: 'success',
                    hideAfter: 2500, 
                    stack: 6
                });
            }else if(XMLHttpRequest.status == "404"){
                //alert("Error");
                $.toast().reset('all');
                $("body").removeAttr('style');
                $.toast({
                    heading: 'Job Is Not Running',
                    text: response,
                    preventDuplicates: 'false',
                    position: 'buttom-right',
                    loaderBg:'#4c7fff',
                    icon: 'error',
                    hideAfter: 2500,
                    stack: 6
              });
            }else{
                //alert("Error");
                $.toast().reset('all');
                $("body").removeAttr('style');
                $.toast({
                    heading: 'Restart Job Failed',
                    text: response,
                    preventDuplicates: 'false',
                    position: 'buttom-right',
                    loaderBg:'#4c7fff',
                    icon: 'error',
                    hideAfter: 2500,
                    stack: 6
              });
            }    
        } 
    });



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2k7tBpM
via IFTTT

Aucun commentaire:

Enregistrer un commentaire