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

Why does jQuery Mobile need a web server?

I'm not getting what's different about jQuery Mobile vs regular jQuery in that it needs to be created/tested on an actual web server. I'm assuming it's because it requires assistance from a back-end language, but that doesn't sound right really... Can someone please explain this?

2 Answers

Hey Josh, I'm a little rusty with my JQuery Mobile skills, but if my memory serves me correctly, JQ Mobile relies heavily on using AJAX. When you set up a webapp using the JQ Mobile framework, flipping between different views / pages is handled by asynchronously loading in content and then applying transitions. It's what gives things the feel of a native app where pages slide or fade in smoothly and there is no hard reload where the browser switches to a different html file (like on a traditional website). In order for the framework to make AJAX calls, things need to be working in a web-server environment. I believe the same is true when using the regular JQuery library for making AJAX calls or if you were manually programming AJAX functionality in Javascript. No real back-end language is required, but the web server is a dependency for AJAX.

If you don't have access to an online web-server, a localhost like WAMP or XAMPP will do the trick for working locally.

Thanks Mark, I knew there had to be a good reason. AJAX must be it!