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 trial

JavaScript

Question 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
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brendan Whiting
Front End Web Development Techdegree Graduate 84,735 Points

URL 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.

Thank you Brendan! Appreciate! Your answer is very very clear

So basically the call back function really receive a status text right?

Yes

Okay gotcha 👌 thank you so much !