javascript - Function that receives a parameter and returns it with no modifications -


i can not figure out usefulness function:

// quick function retrieve parameters in format compatible ajax request var getrequestparameters = function(params){     return params; }; 

i'm seeing in web project, used before every $.ajax() call. can please enlighten me?

it's extension point. serves central point add/remove/customize parameters @ point in future if needs of project change. @ present, doesn't anything, apparently it's there on theory may something.

you've said it's used before every $.ajax call, suggests you're using jquery. means it's bit redundant jquery's own ajaxsend, that's not big deal.

for example, suppose @ point in future needed add unique identifier every ajax request sent. you'd have modify 1 function:

var id = 0; var getrequestparameters = function(params){     params.__uniqueid = ++id; // or perhaps copy params first     return params; }; 

...and you'd have on of ajax requests.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -