I am trying to run this code using zombie.js:
var jqXHR = $.ajax({
url: url,
method: 'GET',
dataType: 'html',
async:false
});
var data = jqXHR.responseText;
console.log("data: " + data);
This code runs well when run on my browser and fetches the html from given url correctly, but when I run it through zombie.js, it doesn't make any GET request and the log always prints "data: undefined".
If I remove the "async" flag and add a success callback, the success callback runs fine, but I cannot understand why synchronous requests are not working.
Can someone tell me how to make synchronous ajax requests work on zombie?
As A. Wolff mentioned in the commets, Zombie doesn't support sync XHR: github.com/assaf/zombie/issues/417
I refactored my code to make the call async based on this answer.