使用jQuery中的each(data,function(){});函数

  • [转自: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 thethis keyword, but Javascript will always wrap thethis value as anObject even 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 文件

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值