jQuery AJAX Methods

Method Description $.ajax() Performs an AJAX request ajaxComplete() Specifies a function to run when the AJAX request completes ajaxError() Specifies a function to run when the AJAX request completes with an error ajaxSend() Specifies a function to run before the AJAX request is sent $.ajaxSetup() Sets the default values for future AJAX requests ajaxStart() Specifies a function to run when the first AJAX request begins ajaxStop() Specifies a function to run when all AJAX requests have completed ajaxSuccess() Specifies a function to run an AJAX request completes successfully $.get() Loads data from a server using an AJAX HTTP GET request $.getJSON() Loads JSON-encoded data from a server using a HTTP GET request $.getScript() Loads (and executes) a JavaScript from the a server using an AJAX HTTP GET request load() Loads data from a server and puts the returned HTML into the selected element $.param() Creates a serialized representation of an array or object (can be used as...

jQuery AJAX Methods

Method Description $.ajax() Performs an AJAX request ajaxComplete() Specifies a function to run when the AJAX request completes ajaxError() Specifies a function to run when the AJAX request completes with an error ajaxSend() Specifies a function to run before the AJAX request is sent $.ajaxSetup() Sets the default values for future AJAX requests ajaxStart() Specifies a function to run when the first AJAX request begins ajaxStop() Specifies a function to run when all AJAX requests have completed ajaxSuccess() Specifies a function to run an AJAX request completes successfully $.get() Loads data from a server using an AJAX HTTP GET request $.getJSON() Loads JSON-encoded data from a server using a HTTP GET request $.getScript() Loads (and executes) a JavaScript from the a server using an AJAX HTTP GET request load() Loads data from a server and puts the returned HTML into the selected element $.param() Creates a serialized representation of an array or object (can be used as...

jQuery Miscellaneous Methods

Method Description data() Attaches data to, or gets data from, selected elements each() Run a function for each element matched by the jQuery selector get() Get the DOM elements matched by the selector index() Search for a given element from among the matched elements $.noConflict() Release jQuery's control of the $ variable $.param() Creates a serialized representation of an array or object (can be used as URL query string for AJAX requests) removeData() Removes a previously-stored piece of data size() Return the number of DOM elements matched by the jQuery selector toArray() Retrieve all the DOM elements contained in the jQuery set, as an array

jQuery Selectors Sample

Selector Example Selects * $("*") All elements # id $("#lastname") The element with id=lastname . class $(".intro") All elements with class="intro" element $("p") All p elements . class . class $(".intro.demo") All elements with the classes "intro" and "demo" :first $("p:first") The first p element :last $("p:last") The last p element :even $("tr:even") All even tr elements :odd $("tr:odd") All odd tr elements :eq( index ) $("ul li:eq(3)") The fourth element in a list (index starts at 0) :gt( no ) $("ul li:gt(3)") List elements with an index greater than 3 :lt( no ) $("ul li:lt(3)") List elements with an index less than 3 :not( selector ) $("input:not(:empty)") All input elements that are not empty :header $(":header") All header elements h1, h2 ... :animated $(":animated") All ani...

jQuery HTML Methods

Method Description addClass() Adds one or more classes (for CSS) to selected elements after() Inserts content after selected elements append() Inserts content at the end of (but still inside) selected elements appendTo() Inserts content at the end of (but still inside) selected elements attr() Sets or returns an attribute and value of selected elements before() Inserts content before selected elements clone() Makes a copy of selected elements detach() Removes (but keeps a copy of) selected elements empty() Removes all child elements and content from selected elements hasClass() Checks if any of the selected elements have a specified class (for CSS) html() Sets or returns the content of selected elements insertAfter() Inserts HTML markup or elements after selected elements insertBefore() Inserts HTML markup or elements before selected elements prepend() Inserts content at the beginning of (but still inside) selected elements prependTo() Inserts content at the beginning o...

jQuery CSS Methods

addClass() Adds one or more classes to selected elements css() Sets or returns one or more style properties for selected elements hasClass() Checks if any of the selected elements have a specified class height() Sets or returns the height of selected elements offset() Sets or returns the position (relative to the document) for selected elements offsetParent() Returns the first parent element that is positioned position() Returns the position (relative to the parent element) of the first selected element removeClass() Removes one or more classes from selected elements scrollLeft() Sets or returns the horizontal position of the scrollbar for the selected elements scrollTop() Sets or returns the vertical position of the scrollbar for the selected elements toggleClass() Toggles between adding/removing one or more classes from selected elements width() Sets or returns the width of selected elements

jQuery AJAX Methods

Method Description $.ajax() Performs an AJAX request ajaxComplete() Specifies a function to run when the AJAX request completes ajaxError() Specifies a function to run when the AJAX request completes with an error ajaxSend() Specifies a function to run before the AJAX request is sent $.ajaxSetup() Sets the default values for future AJAX requests ajaxStart() Specifies a function to run when the first AJAX request begins ajaxStop() Specifies a function to run when all AJAX requests have completed ajaxSuccess() Specifies a function to run an AJAX request completes successfully $.get() Loads data from a server using an AJAX HTTP GET request $.getJSON() Loads JSON-encoded data from a server using a HTTP GET request $.getScript() Loads (and executes) a JavaScript from the a server using an AJAX HTTP GET request load() Loads data from a server and puts the returned HTML into the selected element $.param() Creates a serialized representation of an array or object (can be used as...