stockton Posted July 19, 2008 Share Posted July 19, 2008 I need to understand why one needs or wants to use Ajax. I do understand that moving a large amount of data across a network(and the internet is a network) when only one or two pieces of data are needed is a waste. I am assuming that when a user clicks a button on a form based web page the whole form is moved. Quote Link to comment https://forums.phpfreaks.com/topic/115560-understanding-why-ajax/ Share on other sites More sharing options...
maexus Posted July 19, 2008 Share Posted July 19, 2008 Ajax is simply a way to send and recieve data to and from the server asynchronously. That's it. I think a lot of people completely misunderstand what Ajax is. The bottom line is, ajax can be very useful for some applications but your site should still be 100% functional if javascript is disable. This is true anytime you use ajax. Quote Link to comment https://forums.phpfreaks.com/topic/115560-understanding-why-ajax/#findComment-594341 Share on other sites More sharing options...
roopurt18 Posted July 19, 2008 Share Posted July 19, 2008 AJAX allows for websites to behave more like traditional desktop applications. It's used more to improve the users' experience than to cut down network traffic. Quote Link to comment https://forums.phpfreaks.com/topic/115560-understanding-why-ajax/#findComment-594361 Share on other sites More sharing options...
stockton Posted July 20, 2008 Author Share Posted July 20, 2008 I understand what maexus had to say and if one must allow for users who have javascript disallowed, why use it at all? I am also confused as to why it would "allows for websites to behave more like traditional desktop applications" I can see the advantage on large web pages(I think) but if one has to allow for user with javascript switched off, then why use it at all? Quote Link to comment https://forums.phpfreaks.com/topic/115560-understanding-why-ajax/#findComment-594670 Share on other sites More sharing options...
Daniel0 Posted July 20, 2008 Share Posted July 20, 2008 Visualize a ladder. The higher you climb on the ladder, the richer the user experience. On the bottom of the ladder you have HTML, you have the raw unformatted content. If you climb a little higher then you will reach CSS and your content will now be formatted and look really nice. Climb even higher and you will reach Javascript will define behavior for your content. That is how those three things are often separated into layers. The first one being the content layer, the second being the presentation layer and the third one being the behavioral layer. If you just have the content layer then it will work for the user; s/he can read the content. If you add the second layer then you will style it and the consequently get a richer user experience. Add the last layer and the user will be able to interact with the content (because you added behavior to it) and s/he will get an even richer experience. In your instance this behavior would be whatever AJAX technique you are looking to implement. The reason why you would code if for both Javascript on and off is that you cannot rely on having Javascript on. Some might use a browser that does not support it (e.g. lynx) or they may deliberately turn it off. You shouldn't lock those users out so you should make the page work for them as well. The result is just that they will not benefit from the last layer. As an example of Javascript's richness, try to use Gmail in the default mode (i.e. Javascript) and then in basic mode (HTML-only). I'm sure you will find the Javascript enabled one much better. Quote Link to comment https://forums.phpfreaks.com/topic/115560-understanding-why-ajax/#findComment-594695 Share on other sites More sharing options...
roopurt18 Posted July 20, 2008 Share Posted July 20, 2008 I am also confused as to why it would "allows for websites to behave more like traditional desktop applications When you click on File -> Open in an application, does the entire application shut down, reload, and display an open file dialog? That's what a non-ajax site has to do. You don't always have to make your application work without JavaScript. Some AJAX applications are meant to be run internally on an intranet where you control the environment and a requirement of the application can be that JavaScript has to be enabled. Quote Link to comment https://forums.phpfreaks.com/topic/115560-understanding-why-ajax/#findComment-594934 Share on other sites More sharing options...
Liquid Fire Posted July 21, 2008 Share Posted July 21, 2008 Being able to build a website that acts like a standard application is a good things. If you are building an application that is mainly pulling and sending data from a database(or other data source), building an interface in HTML and logical code is a server side scripting language like php is a lot easier than building everything in a language like C++. As far as a general access website i do believe it is good practice to make your site work with javascript disabled(even tho about %5 seem to be disabled according to w3schools browser stats) even tho it is not a huge requirement but when build web applications(like a project management system) the use of ajax can make the application so much easier to use. Quote Link to comment https://forums.phpfreaks.com/topic/115560-understanding-why-ajax/#findComment-595402 Share on other sites More sharing options...
LemonInflux Posted July 22, 2008 Share Posted July 22, 2008 I'd also like to point out that, because you're not completely reloading the page, AJAX does cut down on bandwidth, both for the server and the user, by a fraction. JavaScript and AJAX are also very useful for making things flow more easily. Think of Google Maps. Can you imagine how tedious that would be if every time you moved the map with your mouse, you had to reload the page? EDIT: On the disabled thing, I have firefox, but I also use NoScripts. NoScripts, by default, disables javaScript for several security/general reasons. It's always very annoying for me when I have to go to 'temporarily allow' just because someone couldn't be bothered to design their site in a compatible way. Quote Link to comment https://forums.phpfreaks.com/topic/115560-understanding-why-ajax/#findComment-596326 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.