ajax傳送請求

2021-08-28 06:43:08 字數 705 閱讀 9204

jquery中.ge

t()提

交和

.get()提交和

.get()

提交和.post()提交有區別嗎?

相同點:都是非同步請求的方式來獲取服務端的資料;

異同點:

1、請求方式不同:.ge

t()方

法使用g

et方法

來進行異

步請求的

。.get() 方法使用get方法來進行非同步請求的。

.get()

方法使用

get方

法來進行

非同步請求

的。.post() 方法使用post方法來進行非同步請求的。

2、引數傳遞方式不同:get請求會將引數跟在url後進行傳遞,而post請求則是作為http訊息的實體內容傳送給web伺服器的,這種傳遞是對使用者不可見的。

3、資料傳輸大小不同:get方式傳輸的資料大小不能超過2kb 而post要大的多

4、安全問題: get 方式請求的資料會被瀏覽器快取起來,因此有安全問題。

11、寫出乙個簡單的$.ajax()的請求方式?

$.ajax(,

beforesend:function(){},

success:function(){},

error:function(){},

complete:function(){}

});

傳送Ajax請求

get請求傳送資料量較小,不能大於2kb,引數追加在url後面,看的到明碼的請求引數值。post請求傳送資料量大小不受限制,請求通過http post機制 將請求引數放在html header中傳輸,看不到明碼的請求引數值。步驟一 建立非同步物件 步驟二 設定請求的url引數,引數一是請求的型別,引...

jQuery傳送Ajax請求

ajax cache false,async true,type post datatype json xml html success function result ajax cache false,async false,type post datatype json xml html suc...

jQuery傳送Ajax請求

ajax cache false,async true,type post datatype json xml html success function result ajax cache false,async false,type post datatype json xml html suc...