I'm Beginner in Javascript. I learned python before. In javascript, I noticed that javascript runs every function with thread. Example:
$.ajax({
url:'/',
type:'GET',
success:function(){
console.log('Response Found!')
},
error:function(){
console.log('Error connecting to the site.')
},
})
console.log('All done!')
Here a jquery ajax request and a console log function. I want to execute ajax request before console log. But the result is:
Console log execute before ajax request. Can any one tell how to wait till the ajax function is completed?