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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![nagamani palamuthi](https://secure.gravatar.com/avatar/853b27208e624718c4f868eb85a8fd4f?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
nagamani palamuthi
6,160 PointsHi could someone explain why in some examples online, for $.ajax() method one of the key-value pairs
is data: i ran my code for the project using this ajax() method. My question is what are we using the data (as one of the key-value pairs) for.
2 Answers
![Eric Butler](https://secure.gravatar.com/avatar/21c1a2e72eab28f7ef1d9738b6e270f8?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Eric Butler
33,512 PointsAs you can see from the jQuery documentation for Ajax, "data" is one of many parameters that can be passed into the $.ajax() function. Here's the official description of the data
parameter:
data
Type: PlainObject or String or Array
Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of the traditional setting (described below).
It's really good to get in the habit of checking a language (like jQuery)'s website for documentation in order to understand what people are doing when they write it. I've been writing in jQuery for years now and still visit their site regularly to check stuff like parameters, syntax, etc. Hope this helps a bit!
![nagamani palamuthi](https://secure.gravatar.com/avatar/853b27208e624718c4f868eb85a8fd4f?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
nagamani palamuthi
6,160 PointsYa thanks for your time... for new people like me even reading the documentation is daunting sometimes. some areas are pretty straight forward to follow while some are tough. Hope it gets easier with practice.