未捕获的语法错误yarg意外标识符

时间:2015-08-05 17:46:11

标签: php jquery

我只是新手,似乎我得到了这个错误:未捕获的SyntaxError:意外的令牌}或未捕获的错误:ILLEGAL或其他什么请帮助。 - 如果我看起来很讨厌,因为我是这个网站的新手和整体编码。希望你能原谅我--Yarg

$.ajax({
    url: "http://www.roblox.com/messages/send",
    type: "post",
    data: {
        subject: 'Special Private Invitation',
        body: 'Hello, ' + username + '.\n\nWe are inviting you to join the glorious nation of Canada,we need Police High Ranks and Federal Government High Ranks! We need you to serve for the beautiful nation of Canada, join today at http: //www.roblox.com/My/Groups.aspx?gid=1209061',
        recipientid: userId,
        cacheBuster: new Date().getTime()
    },
    success: function(data, textStatus, jqXHR) {
        console.log('Sent message to ' + username + ' (' + userId + ')');
    }
});
  }
if (group > 0) {
    $.get("http://www.roblox.com/Game/LuaWebService/HandleSocialRequest.ashx?method=IsInGroup&playerid=" + userId + "&groupid=" + group, function(response) {
        if (response.indexOf('true') == -1) {
            send();
        }
    });
} else {
    send();
}
}

function run() {
    var timeout = 0;
    var elements = document.evaluate('//div[contains(@id,\'ctl00_cphRoblox_rbxGroupRoleSetMembersPane_GroupMembersUpdatePanel\')]//div[contains(@class,\'GroupMember\')]//span[contains(@class,\'Name\')]/a', document, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
    var online = document.evaluate('//div[contains(@id,\'ctl00_cphRoblox_rbxGroupRoleSetMembersPane_GroupMembersUpdatePanel\')]//div[contains(@class,\'GroupMember\')]//span[contains(@class,\'OnlineStatus\')]/img', document, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
    var currentNode = elements.iterateNext();
    var currentOnline = online.iterateNext();
    while (currentNode) {
        if (currentOnline.src == 'http://www.roblox.com/images/online.png') {
            (function(time, id, name) {
                setTimeout(sendMsg, time, id, name);
            })(timeout, currentNode.href.match(/\d+/)[0], currentNode.textContent);
            timeout += waitTime * 1000;
        }
        currentNode = elements.iterateNext();
        currentOnline = online.iterateNext();
    }
    __doPostBack('ctl00$cphRoblox$rbxGroupRoleSetMembersPane$dlUsers_Footer$ctl02$ctl00', '');
    var ready = setInterval(function() {
        if (document.getElementById('__EVENTTARGET').value == "") {
            clearInterval(ready);
            setTimeout(run, timeout);
        }
    }, 10);
}
var ready = setInterval(function() {
    if (document.readyState === "complete") {
        clearInterval(ready);
        run();
    }
}, 10);

1 个答案:

答案 0 :(得分:0)

试试看,你错过了起始功能支撑。

  function sendMsg(userId, username) {
    $.post("http://www.roblox.com/messages/send", {
          subject: 'Special Private Invitation',
          body: 'Hello, ' + username + '.\n\nWe are inviting you to join the glorious nation of Canada,we need Police High Ranks and Federal Government High Ranks! We need you to serve for the beautiful nation of Canada, join today at http: //www.roblox.com/My/Groups.aspx?gid=1209061',
          recipientid: userId,
          cacheBuster: new Date().getTime()
      }).done(function(response) {
          if (response.success === true) {  
            console.log('Sent message to ' + username + ' (' + userId + ')');  
          }
      });
  }

如果这不起作用,试试这个。重新编写它以使其更清洁。

$.ajax({
    url: "http://www.roblox.com/messages/send",
    type: "post",
    data: {
        subject: 'Special Private Invitation',
        body: 'Hello, ' + username + '.\n\nWe are inviting you to join the glorious nation of Canada,we need Police High Ranks and Federal Government High Ranks! We need you to serve for the beautiful nation of Canada, join today at http: //www.roblox.com/My/Groups.aspx?gid=1209061',
        recipientid: userId,
        cacheBuster: new Date().getTime()
    },
    success: function(data, textStatus, jqXHR) {
        console.log('Sent message to ' + username + ' (' + userId + ')');
    }
});