我的Javascript代码中存在错误

我的Javascript代码中存在错误,javascript,Javascript,每当我运行代码时,我总是收到错误,如果有人能解释错误或给我看一个固定版本?我将非常感激 混合内容: “”处的页面已通过HTTPS加载, 但请求了一个不安全的XMLHttpRequest端点 ''. 此请求 已被封锁;内容必须通过HTTPS提供 代码: var globeid=0 var价格低于等于5000 功能检查(z){ $.get(z,函数(数据){ if($(数据).find('#ctl00_cphRoblox_limitedededitionresidence').length){ 变量

每当我运行代码时,我总是收到错误,如果有人能解释错误或给我看一个固定版本?我将非常感激

混合内容:

“”处的页面已通过HTTPS加载, 但请求了一个不安全的XMLHttpRequest端点 ''. 此请求 已被封锁;内容必须通过HTTPS提供

代码:

var globeid=0
var价格低于等于5000
功能检查(z){
$.get(z,函数(数据){
if($(数据).find('#ctl00_cphRoblox_limitedededitionresidence').length){
变量检查=$(数据).find('#BuyWithRobux').children('div').data()
var Token=data.match(/Roblox.XsrfToken.setToken([^)]+)/)[1]。match(/[^(']+/)[0]
如果(勾选['expectedPrice']globeid){
console.log(“新项…”)
globeid=currid
通知弹出窗口(通知[信息])
var nn=通知[信息]
var url=nn.url.split('&')[0]
检查(url)
}
}
})
函数通知弹出窗口(n){
var通知=新通知(n.lite{
图标,图标,
正文:n.header+“\n”+“Price:”+n.items.Price+“\n\n”+“自动购买:关闭”
});
var url=n.url.split('&')[0]
notification.onclick=function(){
log(“通知成功!”);
窗口打开(url);
}
}
}
setInterval(函数(){
checkifnewlim()
}, 100)

如果您的代码在HTTPS页面上运行,您只能从其他域请求HTTPS内容,任何尝试与HTTP资源对话的xhr请求都将被浏览器阻止。如果您试图访问的内容位于您的域中,请确保它是通过HTTPS提供的。否则,您可以执行以下两项操作之一:

  • 如果您运行了一些服务器端代码,您可以尝试添加一个钩子来代理您的调用
  • 人们试图通过使用第三方库来解决这个问题,例如,这对您隐藏了复杂性
var globeid = 0
var priceUnder = 5000


function check(z){
$.get(z, function(data){
          if ($(data).find('#ctl00_cphRoblox_LimitedEditionRemaining').length) {
                var check = $(data).find('#BuyWithRobux').children('div').data()
                var Token = data.match(/Roblox.XsrfToken.setToken([^)]+)/)[1].match(/[^(']+/)[0]
                if (check['expectedPrice'] <= priceUnder) {
                    $.post('https://www.roblox.com/api/item.ashx?rqtype=purchase&productID=' + check["productId"] + '&expectedCurrency=1&expectedPrice=' + check["expectedPrice"] + '&expectedSellerID=1')
                    console.log('Purchased: ' + check["itemName"] + " | " + check["itemId"] + " for " + check["expectedPrice"])
                }
          }
})
}

function checkifnewlim() {
    $.get("https://www.roblox.com/asset/?id=261522650").success(function(r) {
        r = decodeURIComponent(r);
        r = JSON.parse(r.substring(r.indexOf("{"), r.lastIndexOf("}") + 1));
        var notifications = r
        for (var info in notifications) {
            var currid = notifications[info]["id"]
            if (currid > globeid) {
                console.log("NEW ITEM...")
                globeid = currid
                notificationpopup(notifications[info])
                var nn = notifications[info]
                var url = nn.url.split('&')[0]
                check(url)
            }
        }
    })

    function notificationpopup(n) {

        var notification = new Notification(n.lite, {
            icon: n.icon,
            body: n.header + "\n" + "Price: " + n.items.Price + "\n\n" + "Autobuy: OFF"
        });
var url = n.url.split('&')[0]
        notification.onclick = function() {
            console.log("NOTIFICATION SUCCESS!");
            window.open(url);
        }
    }
}
setInterval(function() {
    checkifnewlim()
}, 100)