Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialKeith Short
5,971 Points$.get() Arguments
One of the questions in this quiz is:
jQuery's $.get() method accepts three arguments. What order do they go in?
and the quiz says the correct answer is:
- URL
- Data for the server
- Callback function
But in the next code challenge there is a part that says:
You've got the $.get() method and first argument in place. The second argument to the $.get() method is a callback function.
And only 2 arguments are passed through the $.get() method. The code challenge finishes once you finish the callback function. So does this mean that $.get() only needs 2 arguments and the third is optional?
I'm a little confused about what the data argument is.
Adam Delossantos
5,985 PointsAdam Delossantos
5,985 PointsMy jQuery is a little hazy, but from what I remember, the data argument IS optional. Technically, so is the callback function, although I've almost always included one. In case you haven't already checked, the documentation (https://api.jquery.com/jquery.get/) is more thorough. There are some examples that show how one might include the data argument and omit the callback function. Hope this helps somewhat. Cheers!