使用jQuery中的each(data,function(){});函数
2011-12-21 16:46
411 查看
[转自:http://api.jquery.com/jQuery.each/]
version added:
1.0
jQuery.each( collection, callback(indexInArray, valueOfElement) )
collectionThe object or array to iterate over.callback(indexInArray, valueOfElement)The function that will be executed on every object.
The
$.each()function is not the same as
$(selector).each(), which is used to iterate, exclusively, over a jQuery object. The
$.each()function can be used to iterate over any collection, whether it is a map (JavaScript object) or an array. In the case of an array, the callback is
passed an array index and a corresponding array value each time. (The value can also be accessed through the
thiskeyword, but Javascript will always wrap the
thisvalue as an
Objecteven if it is a simple string or number
value.) The method returns its first argument, the object that was iterated.
jQuery AJAX 请求 参见:http://www.w3school.com.cn/jquery/jquery_ajax.asp
请求 | 描述 |
---|---|
$(selector).load(url,data,callback) | 把远程数据加载到被选的元素中 |
$.ajax(options) | 把远程数据加载到 XMLHttpRequest 对象中 |
$.get(url,data,callback,type) | 使用 HTTP GET 来加载远程数据 |
$.post(url,data,callback,type) | 使用 HTTP POST 来加载远程数据 |
$.getJSON(url,data,callback) | 使用 HTTP GET 来加载远程 JSON 数据 |
$.getScript(url,callback) | 加载并执行远程的 JavaScript 文件 |
相关文章推荐
- jQuery的data函数使用遇到的坑
- jQuery中$.each()函数使用
- Jquery中"$(document).ready(function(){ })"函数的使用详解
- [转]在jQuery的each()函数中使用continue和break
- 关于jquery中全局函数each使用介绍
- 关于Jquery中 “$(document).ready(function(){ })”函数的使用
- 关于jquery中全局函数each使用介绍
- jQuery的遍历函数,.each(function(j,k)){}
- Jquery中"$(document).ready(function(){ })"函数的使用详解
- jquery的each函数使用注意点
- jQuery对象data函数使用注意事项
- 写function自定义函数时使用jquery
- jquery使用each时注意不要把注释写在函数体内
- 【jquery】jquery使用$.each函数遍历对象
- Jquery中"$(document).ready(function(){ })"函数的使用详解
- Jquery中"$(document).ready(function(){ })"函数的使用详解
- jquery的使用----$.each(数组/json数据,function (int/key(变量名随意),value(值变量名) ))
- jQuery的data函数使用遇到的坑
- jquery的data函数定义、使用和修改
- 使用jQuery查找注册到某个DOM对象的事件处理函数