Here is the descrition of getJSON
in jquery
:
$(selector).getJSON(url,data,success(data,status,xhr))
Here success(data,status,xhr)
is a callback function when success. I often see the code below:
$(select(.getJSON('my/url', function(data) {....});
Here variable data
holds the data returned by the http
server. My question is that instead of using name data
here, can I use variable name like server_data
as below?
$(select(.getJSON('my/url', function(server_data) {....});
It's a function argument name. You can name it whatever you want, so long as it follows the valid javascript variable name format.
Ref: What characters are valid for JavaScript variable names?
Edit: Also, easy enough to test without asking a question.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.