0
Consider my code ajax 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()
}
});
}
There is a way for me to call the complete or error, inside the Success, if some value does not come the way I want null or Undefined type?
[EDIT 1] Was that I would like to update the function only again when the request was completed after 3 seconds.
If the value of this null would also only try after 3 seconds
Complete will run only after Success runs. That’s what you want it to be. You could create a function that you can call in the complete and Success. Maybe if you go into more detail your problem will be better for you to answer.
– Rodrigo K.B
Just one observation, the
success
anderror
are obsolete and have been replaced bydone
andfail
in newer versions of Jquery– Costamilam
you can abstract to another function and call this same function within the other 3
– Eduardo Vargas
Create a function outside and call within the two methods!
– novic
Type php that in Try catch if not fall inside the Try I can give a
throw new
to go to the catch– adventistaam