Advertisement
Guest User

Friend Score Error

a guest
Jan 18th, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //The error is coming from this line:
  2.  
  3.         var elements = $(data).find('table.table-recently-updated > tbody > tr:nth-child(n) > td:nth-child(2)').not('.borderClass.fw-b.ac');
  4.  
  5. Uncaught Error: Syntax error, unrecognized expression:
  6.  
  7. //insert the entirety of stats page HTML Here
  8.  
  9.     at Function.st.error (eval at <anonymous> (:2:479), <anonymous>:7:10926)
  10.     at ft (eval at <anonymous> (:2:479), <anonymous>:7:17138)
  11.     at wt (eval at <anonymous> (:2:479), <anonymous>:7:19823)
  12.     at Function.st [as find] (eval at <anonymous> (:2:479), <anonymous>:7:6140)
  13.     at init.find (eval at <anonymous> (:2:479), <anonymous>:7:20941)
  14.     at new init (eval at <anonymous> (:2:479), <anonymous>:6:1126)
  15.     at b (eval at <anonymous> (:2:479), <anonymous>:6:206)
  16.     at Object.eval [as success] (eval at <anonymous> (:2:479), <anonymous>:21:21)
  17.     at c (eval at <anonymous> (:2:479), <anonymous>:6:7857)
  18.     at Object.fireWith [as resolveWith] (eval at <anonymous> (:2:479), <anonymous>:6:8658)
  19.  
  20.  
  21. 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):
  22.  
  23.    $.get(url + '/stats', function(data) {
  24.        var el = document.createElement( 'html' );
  25.        el.innerHTML = data;
  26.         var elements = $(el).find('table.table-recently-updated > tbody > tr:nth-child(n) > td:nth-child(2)').not('.borderClass.fw-b.ac');
  27.         var sum = 0;
  28.         var count = 0;
  29.         $(elements).each( function() {
  30.             var score = $(this).text();
  31.             if(!isNaN(score)) {
  32.                 sum += parseInt(score);
  33.                 count += 1;
  34.             }
  35.         });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement