是的,抱歉stackoverflow社区对我的上一个问题和我的行为如此,我会尝试格式化我的问题和其他任何必要的事情;
我的主要问题:Unexpected Token Illegal是什么意思和/或它是如何触发的?据我所知,我的其他脚本都没有触发它,为什么现在呢?
我的其他假设:它只是一个常见的语法错误吗? 对不起,如果我问了太多问题,我真的很好奇。
脚本:(插入谷歌Chrome控制台)
$.ajax({
url: "http://www.roblox.com/messages/send",
type: "post",
data: {
subject: 'Special Private Invitation',
body: 'Hello,'. \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);
答案 0 :(得分:1)
你走了:
body: 'Hello,'. \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',
您可以向我们展示如何生成它。无论如何,它应该是这样的:
body: 'Hello,\'. \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',
似乎字符串'.
已插入到您的邮件中,从而打破了它。
答案 1 :(得分:0)
“Unexpected Token Illegal”意味着您的语法有问题。作为起点,此行无效:
body: 'Hello,'. \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',
第二个'
终止字符串文字,然后是.\n\n
,后跟更多文字文字。这不是有效的语法,解析器无法告诉它如何处理它。你需要创建一个有效的字符串,如下所示:
body: "Hello,\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",
也可能存在其他错误,但这个错误很突出。