Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I avoid using a JavaScript library while learning how to write AJAX client code? [closed]

Tags:

Is it better to learn how to code AJAX without the use of an AJAX library? What are the advantages of coding from scratch over using a library such as jQuery?

See also:

What are some of the pros and cons of using jQuery?

like image 762
bloudermilk Avatar asked Oct 18 '08 21:10

bloudermilk


2 Answers

For learning, yes, avoid libraries. Especially for something as conceptually simple as AJAX, forcing yourself to learn how the browser can be used "raw" will benefit you immensely later on, even if you are using a library to take care of the drudgery and abstract away browser differences.

Once you have a solid understanding of how it works though, use a library, if for no other reason than spending time working around subtle browser differences is a waste. Better yet though, spending some time reading through the source of jQuery and others will give you insight into what well-written JavaScript looks like - and that in turn will benefit the code you do write!

like image 81
Shog9 Avatar answered Oct 19 '22 05:10

Shog9


While I think it is really important to understand conceptually what is going on and be able to correctly implement calls using an AJAX library, I disagree with @Shog9 that you need to write the actual code to perform an XmlHttpRequest in order to start using AJAX. I'd say do some background reading to understand the concepts -- implement the code samples demonstrating them if you want -- but once you get the concept, find some tutorials on how to do stuff with AJAX with or without libraries. You'll soon find that others have been there before and left pretty good sign-posts on how to get around.

I agree with the sentiment about looking at framework code to see how to write good code.

like image 32
tvanfosson Avatar answered Oct 19 '22 05:10

tvanfosson