Asked  2 Years ago    Answers:  5   Viewed   60 times

Today this caught my attention on jQuery's API Documentation for the closest selector:

.closest( selector [, context ] )

What exactly does [, context] mean? I know I can put a variable or jQuery object there to set as the context. This itself isn't entirely clear to me, but the part in particular I'm asking about today is the square bracket comma ( [, ). What does this mean? I've also seen similar notation on's manual pages.

bool ob_start ([ callable $output_callback [, int $chunk_size = 0 [, ...

Is there some preliminary lesson I've missed? because this is greek to me and I can't be the only one who's looked at this and thought "WTF..." but ignored it and went on guessing, when I could have saved a lot of time...



It means that parameter is optional. You don't have to provide it and if you don't it will use the value you see listed there by default.

Friday, September 2, 2022

dataType - delete this one.

Add console.log and open console in Your browser

success: function (data) {
   console.log( data );

show Your console, and then You will see why. Maybe an unwanted char or php error

Second thing - there should be if stament like this (I supposed)

if (data == "1") // it is returning string, not integer.

You can also try to use switch case in success.

Tuesday, November 29, 2022

this (in the context of a module) is the same as exports in node.js. However you should generally use exports/module.exports instead, so that it's explicitly clear what you're modifying.

Wednesday, October 12, 2022

add target=_blank in your ajax success function like below

success: function(){'http://YOUR_URL','_blank' );

otherwise you can handle smartly to open your Excel download link in new tab with jQuery trigger function or etc.

Saturday, December 10, 2022

They're known as generics in java, and templates in C++.

Monday, October 31, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :

Browse Other Code Languages