2015-08-05 2 views
-1

Я только новичок в этом, и кажется, что я получаю эту ошибку: Неиспользуемый SyntaxError: Неожиданный токен} или Неподготовленная ошибка: НЕЗАКОННАЯ или что-то, пожалуйста, помогите. -Извините меня, если я могу показаться раздражающим, поскольку я новичок в этом веб-сайте и в целом кодирую. Надеюсь, вы сможете простить меня -Яргunsached синтаксическая ошибка 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); 
+0

Какой «неожиданный идентификатор» вы получаете? –

+0

сразу после строки определения функции, что вы получаете, когда вы кладете 'console.log (userID + ',' + username);'? – Sablefoste

+0

вы не открыли фигурные скобки на функциональной строке – Sayed

ответ

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 + ')'); 
    } 
}); 
+0

Пробовал это и получил Uncaught SyntaxError: Неожиданный токен ILLEGAL – Yarg

+0

@Yarg теперь попробуйте код. – Script47

+0

Я добавил остальную часть скрипта, извините, если мне кажется раздражающим, я новый <_ < – Yarg

Смежные вопросы