- 相關(guān)推薦
jQuery中ajax的get()方法運(yùn)用示例
jQuery中ajax的get()方法運(yùn)用示例
$.get()通過(guò) HTTP GET請(qǐng)求從服務(wù)器上請(qǐng)求數(shù)據(jù)。
語(yǔ)法結(jié)構(gòu):
復(fù)制代碼 代碼如下:$.get(url, [data], [callback], [type]);
參數(shù)解析:
1.URL:必須,規(guī)定請(qǐng)求的URL。
2.data:可選,待發(fā)送 Key/value 參數(shù)。
3.callback:可選,請(qǐng)求成功后所執(zhí)行的回調(diào)函數(shù)。
4.type:可選,返回內(nèi)容格式,xml, html, script, json, text, _default。
代碼實(shí)例:
復(fù)制代碼 代碼如下:
$(document).ready(function(){
$("#bt").click(function(){
$.get("mytest/demo/antzone.txt",function(data,status){
alert("Data:"+data+"nStatus:"+status);
})
})
})
希望本文所述對(duì)大家的'jQuery程序設(shè)計(jì)有所幫助。
【jQuery中ajax的get()方法運(yùn)用示例】相關(guān)文章:
jQuery中prev()方法用法07-16
解析ajax請(qǐng)求post和get的區(qū)別10-01
使用ajax操作JavaScript對(duì)象的方法09-28
基于ajax實(shí)現(xiàn)無(wú)刷新分頁(yè)的方法10-15
速記在語(yǔ)文學(xué)習(xí)中的運(yùn)用方法08-05
淺談Ajax修改購(gòu)物車的方法06-29
jQuery中parent()和siblings()的問題10-16