javascript - XMLHttpRequest or $.ajax? -
thanks experience, it's better use dom object xhr or ajax method jquery ?
or maybe depends on points performance, reliability, or usability ? i'd have views
i recommend using library such jquery rather writing own ajax system using httpxmlrequest.
firstly, jquery's ajax code exists, , has been thoroughly tested. known work well, work in browsers, , secure.
if writing own ajax code, you'd never quite sure on either of points. you'd never able testing jquery.
jquery's ajax code extremely easy use. , there excellent examples , tutorials on web. if write own, you'll need consider writing documentation (consider guy has take on maintenance of code in few years! ;-))
plus, if there security bugs found in jquery, can sure there patch released pretty quickly. if code has security bug, wouldn't know until after realised site being hacked.
the time should consider not using library sort of thing if you're in environment resources extremely tight. example, know site need work extremely low-memory computers, or low bandwidth, make overhead of downloading library jquery prohibitive. in case, you're unlikely writing ajax-capable code anyway.
i should point out jquery isn't library out there can sort of thing. jquery great, if want try else, there number of others similar capabilities. there number of smaller ajax-specific libraries, if don't need overhead of full blown framework jquery.
Comments
Post a Comment