Error with version 1.10.4

Error with version 1.10.4

MindzMindz Posts: 10Questions: 3Answers: 0

Hi,

Just started using version 1.10.4 with jquery 1.11.0 . The following error occurs when i load the datatables script in the page.
Chrome:
Uncaught TypeError: object is not a function
Firefox dev:
$ is not a function

Jquery is loaded first, followed by datatables.
Any particular reason for this error?

Best regards

Answers

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    Can you please link to a page showing the issue, as per the forum rules.

    My best guess at the moment is that jQuery is being loaded twice on the page.

    Allan

  • MindzMindz Posts: 10Questions: 3Answers: 0

    Sorry, first question i posted. Didnt read the rules :)

    As for an example, its quite hard to reproduce since im developing a new frontend for the company.
    Regarding the issue, you were right! Jquery is beeing loaded twice, but i have no control over the dependencies at the moment. However, with datatables version 1.9 the issue does not occur. Do you have any idea why?
    Thanks in advance.

    Mindz

  • MindzMindz Posts: 10Questions: 3Answers: 0

    I rechecked the imports and, the jquery is indeed loading twice but, one of them is inside an iframe so that shouldnt cause the problem.

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    You are right - loading it in an iframe shouldn't be in issue. In which case I'm afraid I'm out of ideas and would need to be able to debug the page to understand what is going wrong.

    Allan

  • MindzMindz Posts: 10Questions: 3Answers: 0

    Hi Allan,

    I found that there's a conflict between datatables 1.10.4 and URI.js.
    The imports are made in the following order:

    JQuery 1.11.0
    Angularjs
    .
    .
    .

    URI.js 1.4.2
    .
    .
    .
    Any suggestions?

    Thanks in advance,
    Hugo

  • MindzMindz Posts: 10Questions: 3Answers: 0

    Forgot to mention it... but datatables is imported after URI.js. Im working on a jsfiddle to post here

  • MindzMindz Posts: 10Questions: 3Answers: 0

    Ok, the source of the problem is that URI.js (at least v1.4.2, ill try to upgrade to the latest version to verify if the error persists) is loaded before datatables.

  • MindzMindz Posts: 10Questions: 3Answers: 0

    Problem solved! Upgrading URI.js to the latest version (1.14.1) solves the problem.

This discussion has been closed.