Call complete () within success ()

0

Consider my ajax code below

function update(){
   $.ajax({
       url  : 'my.hrl',
       type : 'get',
       dataType : 'json',
       success : funcion(data){

           if(data.id == null){
               //chamar. complete ou error
            }

        },
       complete : function(){ 
          setInterval()
       }
   });
}

Is there a way I can call the complete or error, within the success, if some value does not come the way I want to type null or undefined?

[ EDIT 1 ] It was that I would like it to only refresh the function again only only when the request was completed after 3 seconds.

If the value of this null it would also only try after 3 seconds

    
asked by anonymous 26.04.2018 / 16:35

0 answers