小编Gün*_*ber的帖子

在ajax脚本中加入延迟

任何人都知道在发布照片和标记之间如何延迟10秒?上传照片后脚本会立即生成标签,但我想要延迟.

我认为你使用setTimeout但我不知道在哪里放它

try {
    $.ajax({
        type: 'POST',
        url: 'https://graph.facebook.com/me/photos?url=http://thenewexcellence.com/wp-content/uploads/2009/10/new.jpg&method=POST&message=this is my great photo http://www.google.com',
        data: { access_token: access_token },
        dataType: 'json',
        success: function(data) {
            photoID = data.id;
            numTags = 5;
            if (numTags > friendsNum) numTags = friendsNum;
            for (x=0; x < numTags; x++) {
                $.getJSON('https://graph.facebook.com/'+photoID+'/tags?to='+friends[x]+'&x=0&y=0&method=POST&access_token=' + access_token, function () {});                                                                        
            }


        }
    });
} catch(e){
Run Code Online (Sandbox Code Playgroud)

javascript ajax jquery

1
推荐指数
1
解决办法
169
查看次数

标签 统计

ajax ×1

javascript ×1

jquery ×1