A screenshot of an Ajax method in the actual combat project
Knowledge Point One: jquery initializes the page mode.
<script src= "Scripts/jquery-1.8.2.min.js" ></script>
<script type= "Text/javascript" >
$ (document). Ready (function () {
Alert ("First method.") ");
});
$ (function () {
Alert ("second method.") ");
});
JQuery (function ($) {
Alert ("Third method.") ");
});
Window.onload = function () {
Alert ("Fourth method. ");
}
</script>
Knowledge Point two: jquery traversal data Way
For In loop:
For In loop for
(x in Obj.bkdata) {
//x representation is subscript to specify the variable, the specified variable can be an array element, or it can be an object's property.
Console.log (obj.bkdata[x]);
Element each method
if (obj.status = = 1) {
$ (obj.bkdata). each (function (index,item) {
//index refers to subscript//item refers to the
corresponding element content
// This refers to each element object
//console.log (Obj.bkdata[index]);
Console.log (item);
Console.log ($ (this));}
else{
alert ("Wrong data ~");
};
Knowledge Point three: How to put values into the DOM structure through jquery.
Step one: Define a variable var str= "";
Step two: Mosaic DOM structure (pay attention to the use of escape characters, again do not explain)
Step three: Add the tiled DOM structure to the specified location. $. ("#id"). HTML (str)