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!
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 trial
Logen Li
Courses Plus Student 1,276 PointsQuestion about $get url
Hi Guys!
in $.get method :
we have a URL feature. What is this URL mean? I know it is connected to the server, but how what exactly this URL work? Because sometimes I see that the URL can even be a form "action" attribute. Just a little bit confused
2 Answers

Brendan Whiting
Front End Web Development Techdegree Graduate 84,731 PointsURL stands for Uniform Resource Locator. It's basically an address on the web.
It could be the address of HTML, which will then get rendered into a nice web page by the browser, such as the one we're looking at right now, which has an address of https://teamtreehouse.com/community/question-about-get-url, and returned the HTML that you can look at in the Chrome Developer tools.
It could also be an address of some JSON data, for example this is the URL for the JSON of your profile: https://teamtreehouse.com/logenli.json. When you're using jQuery's $.get()
method, you're often doing an AJAX request for some JSON like that.
In the context of a <form>
element, the action
attribute of the form is the URL that we're going to send the data to, the data from the form fields that the user filled out.
If you haven't already, this Treehouse course on HTTP is good and might help fill some gaps here.

Logen Li
Courses Plus Student 1,276 PointsOkay gotcha 👌 thank you so much !
Logen Li
Courses Plus Student 1,276 PointsLogen Li
Courses Plus Student 1,276 PointsThank you Brendan! Appreciate! Your answer is very very clear
Brendan Whiting
Front End Web Development Techdegree Graduate 84,731 PointsBrendan Whiting
Front End Web Development Techdegree Graduate 84,731 PointsThe callback function of
$.get()
?Logen Li
Courses Plus Student 1,276 PointsLogen Li
Courses Plus Student 1,276 PointsSo basically the call back function really receive a status text right?
Logen Li
Courses Plus Student 1,276 PointsLogen Li
Courses Plus Student 1,276 PointsYes
Brendan Whiting
Front End Web Development Techdegree Graduate 84,731 PointsBrendan Whiting
Front End Web Development Techdegree Graduate 84,731 PointsAccording to the docs, it looks like the callback function gets the status as well as the data you're requesting (hopefully) but maybe not if there's an error.