Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //The error is coming from this line:
- var elements = $(data).find('table.table-recently-updated > tbody > tr:nth-child(n) > td:nth-child(2)').not('.borderClass.fw-b.ac');
- Uncaught Error: Syntax error, unrecognized expression:
- //insert the entirety of stats page HTML Here
- at Function.st.error (eval at <anonymous> (:2:479), <anonymous>:7:10926)
- at ft (eval at <anonymous> (:2:479), <anonymous>:7:17138)
- at wt (eval at <anonymous> (:2:479), <anonymous>:7:19823)
- at Function.st [as find] (eval at <anonymous> (:2:479), <anonymous>:7:6140)
- at init.find (eval at <anonymous> (:2:479), <anonymous>:7:20941)
- at new init (eval at <anonymous> (:2:479), <anonymous>:6:1126)
- at b (eval at <anonymous> (:2:479), <anonymous>:6:206)
- at Object.eval [as success] (eval at <anonymous> (:2:479), <anonymous>:21:21)
- at c (eval at <anonymous> (:2:479), <anonymous>:6:7857)
- at Object.fireWith [as resolveWith] (eval at <anonymous> (:2:479), <anonymous>:6:8658)
- It remember this working at one point, so I don't know why its not anymore, but it can be fixed by doing something like this (https://stackoverflow.com/questions/10585029/parse-a-html-string-with-js):
- $.get(url + '/stats', function(data) {
- var el = document.createElement( 'html' );
- el.innerHTML = data;
- var elements = $(el).find('table.table-recently-updated > tbody > tr:nth-child(n) > td:nth-child(2)').not('.borderClass.fw-b.ac');
- var sum = 0;
- var count = 0;
- $(elements).each( function() {
- var score = $(this).text();
- if(!isNaN(score)) {
- sum += parseInt(score);
- count += 1;
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement