Last active
June 22, 2017 02:25
-
-
Save lastday154/ddc4f1423f83c70ae58e8924e5e586f7 to your computer and use it in GitHub Desktop.
Synchronous request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Synchronous request to get 3 unique messages from zalora.sg | |
var messages = []; | |
while(messages.length < 3) { | |
$.ajax({ | |
url: 'https://www.zalora.sg/ajax/catalog/justforyou/?feedName=recentlyviewed&brandName=&size=20&category=&userId=10214339066013667&engine=datajet', | |
async: false | |
}) | |
.done(function(msg){ | |
if(messages.indexOf(msg) == -1) { | |
messages.push(msg); | |
} | |
}) | |
.fail(function() { | |
alert( "can not get message from zalora"); | |
}); | |
} | |
console.log(messages); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment