Error: Invalid number of arguments in Javascript

Hi,

I have an issue in my javascript :

I want to do a AJAX request but, PHPStorm says this error : Invalid number of argument, expected 5.

I use the plugin jQuery Datatables , and use PHP for my connexion to my database PHPmyAdmin

I think I don't need any argument, so I don't understand.

If someone can help me.

Thanks

10 comments
Comment actions Permalink

What file/definition is `$` resolved to? Ctrl+click `$` - what definition is opened?

Note that I'd strongly recommend using TypeScript stubs for JQuery completion: in Settings | Languages & Frameworks | JavaScript | Libraries, press Download..., choose jquery from the list

3
Comment actions Permalink

Got the same exact problem with PHPStorm 2019.2, but since DataTable colReorder isn't used very often in my code, I just located the colReorder.js file in the project and File > Mark > Plain Text. This excludes it from indexing, and lets jQuery come to the fore.

Of course, this way should I ever use the colReorder function anywhere, PHPStorm would complain it doesn't know of it, but that's a minor problem.

3
Comment actions Permalink

Thanks Elena, I found the solution with the definition !

 

1
Comment actions Permalink

This is still a thing. The easiest fix was just editing  a comment in colReorder / datatables code

From:
@method $.fn.dataTableExt.oApi.fnColReorder

To:
@method fn.dataTableExt.oApi.fnColReorder

That is all.   
Installing TypeScript stubs as Elena recommended is still a great suggestion 

1
Avatar
Vladimir Luchansky
Comment actions Permalink

Hello,

How is jQuery library added to your project? If it's a manually added as a library file, is it full (debug) version or a minified one?

0
Comment actions Permalink

Hi,

I use a jQuery library file, full version, but the plugin datatables is a minified one.

0
Comment actions Permalink

Hi, I have the same problem with PHPStorm since the last update, when I CTRL-CLICK on $ it's open a DataTables plugin file (colReorder). I tried to download the library but I still have the problem.

0
Comment actions Permalink

this is happening to me, I'm using DataTable colReoder and I'm getting this advertisment. If I Control + Click on the '$' it navigates to datatables.colReoder.js instead of jQuery.

Lserni says to File > Mark > Plain text but there is no this option on the menu on PHPStorm 2021.2.2

any help?

thanks in advance

0
Comment actions Permalink

>but there is no this option on the menu on PHPStorm 2021.2.2

this action has been removed recently, 'Override File Type | Plain text' has to be used instead

0

Please sign in to leave a comment.