Answer the question
In order to leave comments, you need to log in
How can I pass value from success (ajax)?
I have an ajax request
var user = "";
$.ajax({
url: Url,
type:"GET",
success:function(data) {
user = data.user;
},
error:function (xhr, ajaxOptions, thrownError){
console.log(xhr.responseText);
}
});
console.log (user);
Answer the question
In order to leave comments, you need to log in
How can I make a function run only after another one has completed?
Look like this:
var user = "";
$.ajax({
url: Url,
type:"GET",
success:function(data) {
user = data.user;
console.log (user);
},
error:function (xhr, ajaxOptions, thrownError){
console.log(xhr.responseText);
}
});
console.log (user);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question