Load JSON data with jQuery

JSON data can be retrieved using AJAX from a server either using jQuery’s .ajax() function or the shorthand $.getJSON() function. If you have retrieved a JSON string without having jQuery decode it automatically using one of these functions, the string can also be parsed into a regular data array using the $.parseJSON() function.

Get an element’s position relative to the document with jQuery

jQuery’s .offset() method returns an offset containing the top and left co-ordinates of the element top-left position relative to the document as a whole. There’s is also a .position() method which is supposed to return the offset relative to the offset parent but for me it always returns the same co-ordinates as .offset(). Maybe I’m doing something wrong with .position()…

Detecting the browser engine and version with jQuery

While you ideally shouldn’t use browser detection to choose whether or not to render something in a particular fashion, jQuery does provide the capability to work out which browser renderingengine and version is being used with $.browser. There is also $.support which provides information about what the rendering engine supports and I will look at that in a later post.