没有错误,但代码不会在AJAX调用中进行AJAX调用?

时间:2013-11-11 15:00:57

标签: javascript ajax call

目前我的脚本没有错误,在JSHint中只有2个问题(但没有一个是关键的(我认为))。这是我应该工作的脚本,但不是。

    var hats = [31151864, 16412796, 95245701, 61847146]; 
var names = ["a", "b", "c", "d"];
var request = 65;

var Loop = setInterval(function () {
    for (var Id in hats) {
        var origLink = "http://www.roblox.com/"+names[Id]+"-item?id=" + hats[Id];
        $.get(origLink, function(data) {
            var Regex = /item\Dprivatesale\Dprice\D\D([\d,]+)\D\Dspan\D/;
        console.log(data.match(Regex)[1]);
            var PriceSelling = data.match(Regex)[1];
            if (PriceSelling <= request) {
                var hatBuying = "http://m.roblox.com/items/" + hats[Id] + "/privatesales";
console.log(hatBuying);
    $.get(hatBuying, function(data){console.log("Success!");
                    var Regex2 = /Catalog\DVerifyTransfer\DuserAssetOptionId\D([\d,]+)\Damp\DexpectedPrice\D/+PriceSelling+/\D\D/;
                    var buyId = data.match(Regex2)[1];
                                        console.log(buyId);
                    var buyLink = "http://m.roblox.com/Catalog/VerifyTransfer?userAssetOptionId=" + buyId + "&expectedPrice=" + PriceSelling;
                    var Explorer = document.createElement('iframe');

                    function Buy() {
                        Explorer.contentDocument.forms[0].submit();
                    }

                    Explorer.onload = Buy;
                    Explorer.width = "300";
                    Explorer.height = "400";
                    Explorer.src = buyLink;
                    document.body.innerHTML = "";
                    document.body.appendChild(Explorer);
                    clearInterval(Loop);
                });
            }
        });
    }
console.log("!");
}, 500);

目前,帽子4(d)以65'robux'货币出售,所以我得到的输出是:

65 http://m.roblox.com/items/61847146/privatesales

发生了什么事?它甚至没有启动第二个AJAX调用,即使它应该。请帮忙?谢谢!

0 个答案:

没有答案