0

I have an old site, so i update the jquery to the latest version, now i have a lot of errors in the console : a.indexOf is not a function and Query.Deferred exception: a.indexOf is not a function.

I have search the net and found it maybe of this script that is deprecated:

<script type="text/javascript">
    $(document).ready(function() {
    $("#main2").load("newsong.php");
    var refreshId = setInterval(function() {
    $("#main2").load('newsong.php?randval='+ Math.random());
    }, 30000); //30 SEGUNDOS
 });
</script>

i try to change it like this but failed:

"replace them with .on() to register listeners instead. Example:

$(window).load(function(){...});

becomes:

$(window).on('load', function(){ ...});"
Romano
  • 57
  • 1
  • 8
  • Why is `php` tag here? – u_mulder Jan 13 '18 at 18:03
  • make sure you did load the jQuery library – Funk Forty Niner Jan 13 '18 at 18:05
  • there isn't enough code here neither; post the html for this also – Funk Forty Niner Jan 13 '18 at 18:06
  • @FunkFortyNiner i think it is loaded like this: – Romano Jan 13 '18 at 18:07
  • The change you applied makes no sense. Jquery [load method](http://api.jquery.com/load/) loads data for the server, while $(selector).on('load') would register a listener that would be invoked when the **load** event is triggered. – Romulo Jan 13 '18 at 18:09
  • There are too many possible duplicates. Googling that error showed this https://stackoverflow.com/questions/38871753/uncaught-typeerror-a-indexof-is-not-a-function-error-when-opening-new-foundat of many. Check your jQuery version also. – Funk Forty Niner Jan 13 '18 at 18:11
  • Possible duplicate of ["Uncaught TypeError: a.indexOf is not a function" error when opening new foundation project](https://stackoverflow.com/questions/38871753/uncaught-typeerror-a-indexof-is-not-a-function-error-when-opening-new-foundat) – Jonathan Apr 08 '18 at 08:31

0 Answers0