Size: 1472
Comment:
|
Size: 2466
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
## page was renamed from jquery | |
Line 2: | Line 3: |
The purpose of jQuery is to make it much easier to use JavaScript on your website. | The purpose of jQuery is to make it much easier to use [[Javascript]] on your website. |
Line 61: | Line 62: |
== jQuery.get( url [, data ] [, success ] [, dataType ] ) == Returns jqXHR Load data from the server using a HTTP GET request. {{{#!highlight javascript $.get( "test.cgi", { name: "John", time: "2pm" } ) .done( function( data ) { alert( "Data Loaded: " + data ); }); $.ajax({ url: url, data: data, success: success, // function(data, textStatus,jqXHR ) error: error , // function( jqXHR, textStatus, errorThrown ) dataType: dataType // text, html, xml, json, jsonp, and script. }); }}} == Select element with . and : in id == https://learn.jquery.com/using-jquery-core/faq/how-do-i-select-an-element-by-an-id-that-has-characters-used-in-css-notation/ {{{#!highlight javascript function jq( myid ) { return "#" + myid.replace( /(:|\.|\[|\])/g, "\\$1" ); } }}} == Ajax error handler == {{{ function onError(xhr, status, error){ console.log(xhr.responseText); // text returned on error } }}} |
jquery
The purpose of jQuery is to make it much easier to use Javascript on your website.
DOM ready
Find element by id
Find elements by class
Get or set select dropdownlist selected value
.attr( attributeName )
Returns String Get the value of an attribute for the first element in the set of matched elements.
.text()
Returns String Get the combined text contents of each element in the set of matched elements, including their descendants.
html()
Returns String Get the HTML contents of the first element in the set of matched elements.
.append( content [, content ] )
Returns jQuery Insert content, specified by the parameter, to the end of each element in the set of matched elements.
.empty()
Returns jQuery Remove all child nodes of the set of matched elements from the DOM.
jQuery.get( url [, data ] [, success ] [, dataType ] )
Returns jqXHR Load data from the server using a HTTP GET request.
1 $.get( "test.cgi", { name: "John", time: "2pm" } )
2 .done( function( data ) {
3 alert( "Data Loaded: " + data );
4 });
5
6 $.ajax({
7 url: url,
8 data: data,
9 success: success, // function(data, textStatus,jqXHR )
10 error: error , // function( jqXHR, textStatus, errorThrown )
11 dataType: dataType // text, html, xml, json, jsonp, and script.
12 });
Select element with . and : in id
Ajax error handler
function onError(xhr, status, error){ console.log(xhr.responseText); // text returned on error }