JQuery

Basic Syntax of JQuery:
$(Selector).action()
$:
Indicates it is a jQuery.
Selector: 3 types of name
Id of an element (prefixed by #). $(“#myButton”) - selects html element with id “myButton”.
HTML element itself. $(“p”) - selects html paragraphs.
CSS class (prefixed by . (Period)) Etc.
$(“.myclass”) - selects html elements which have their class ”myclass
           //get the parent's the jQuery element.
          var tblTmp =window.parent.$('#tt');
          var data = window.parent.$.fn.panel.defaults.extractor(data);
          var tmp = window.parent.$('<div></div>').html(data);
Examples:
$(":checkbox, :radio").click( showValues ); -for all <input type="checkbox" ...> and all <input type="radio" ...>
$("select").change( showValues ); - for all <select ...>

function showValues() {
  var fields = $( ":input" ).serializeArray();
  $( "#results" ).empty();
  jQuery.each( fields, function( i, field ) {
   $( "#results" ).append( field.value + " " );
  });
}
action():

A action (function) to be fired on that element.
 Ref:h t t p : //w w w . c o d eproject.com/Articles/667620/JQuery-A-Quick-Start-Guide
 
         var hide_progress = function (event, args) {
            var obj = $("#wf_loaded");
            obj.remove();
            window.status = "Loaded";
            //document.getElementById("progress-message").textContent = "Loaded";
            return true;
        }
        var show_progress = function (event, args) {
$("#mainform").append('<div id="wf_loaded" style="position: fixed;left:35%;top:50%;margin: 2 auto;width: 50%;z-index: 99999;" ><span>loading</span></div>');

            window.status = "Please wait..";
            //document.getElementById("progress-message").textContent = "Please wait. . .";
            return true;
        } 
& Ajax
$.ajax({
    url: 'YourRestEndPoint',
    headers: {
        'Authorization':'Basic xxxxxxxxxx',
        'X_CSRF_TOKEN':'xxxxxxxxxxxxxxx',
        'Content-Type':'application/json'
    },
    method: 'POST',
    dataType: 'json',cache: false,
    data: YourData,
    success: function(data){
      console.log('succes: '+data);
    },
    complete: function() {
      //alert(data);
    }
  });
 
 

评论

此博客中的热门博文

XML, XSL, HTML

Input in element.eleme.io

Data URI是由RFC 2397 ACE