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 AJAX Basics (retiring) AJAX Concepts A Simple AJAX Example

Ryan Boyd
Ryan Boyd
7,561 Points

How does one set up a local web server for AJAX?

In the video Dave says you can set up a local web server on your computer, or upload to a web server but it's not easy. I am curious to know or find good resources on how to do this?

2 Answers

Hi Ryan, When you are making AJAX requests using stand alone html files, the HTTP request to the url is made by the browser. All you need to make sure is that you have included JQuery. Here is what you have to do. <script src="js/jquery-1.10.2.min.js"></script> The JQuery here resides in the js folder. This is included in the stand alone html file. Now to make the AJAX request use the following code.

$.ajax({ type: 'GET', url: url,

      success: function(data){
          console.log(data);
      },
      async:false
  });
Ryan Boyd
Ryan Boyd
7,561 Points

Oh wow, totally missed the teachers notes....Apache XAMPP and use localhost