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 trialFloyd Orr
11,723 Pointswhat does getJSON() do that regular get() can't do?
I must be missing something. What is the advantage or one over the other?
2 Answers
Merritt Lawrenson
13,477 PointsBoth are shorthand methods in jQuery. 'getJSON()' gets JSON, whereas 'get()' requires you to specify the datatype yourself. 'getJSON()' is just one argument shorter.
For more info:
Michael Fish
7,804 PointsHello Floyd,
I believe the get() method can return multiple things from the server. getJSON() is purely for JSON encoded data. I assume getJSON() is just a more specific way to use the get() method. Hope this was helpful!
Mike
Floyd Orr
11,723 PointsThank you Mr Fish