xmlhttp提交表單

2021-09-05 13:40:52 字數 1484 閱讀 7260

xmlhttp是在ria時代沒有來臨之前, 最能使b/s程式遠離每個動作重新整理一次頁面的痛苦做法,

同時也是最平民化的一項技術,helloword幾句話就完成了.

不過,大家對xmlhttp的應用大多只以get方式在url裡傳遞少數的變數, 對於大量資料的form,還是會選擇form.submit()一次.

其實,只要稍加封裝,xmlhttp一樣可以完成複雜表單的後台提交,真正做到讓用家賓至如歸,不到頁面本身需要重新整理的時候,決不去重新整理用家的介面.

客戶端:

function xmlhttp_submit(form_object,url)

end function

上面這段**遍歷了form裡的物件,組裝出form_value字串,然後通過send()方法以post方式傳送給伺服器端。

又是經典的中文編碼問題,需要加多乙個urlencoding函式把變數值的字串編成utf-8格式,而且也因此採用不熟悉的vbscript自己不熟悉來寫form_submit()。

function urlencoding(vstrin)

strreturn = ""

for i = 1 to len(vstrin)

thischr = mid(vstrin,i,1)

if abs(asc(thischr)) < &hff then

strreturn = strreturn & thischr

else

innercode = asc(thischr)

if innercode < 0 then

innercode = innercode + &h10000

end if

hight8 = (innercode and &hff00)\ &hff

low8 = innercode and &hff

strreturn = strreturn & "%" & hex(hight8) & "%" & hex(low8)

end if

next

urlencoding = strreturn

end function

伺服器端什麼特別的事情都不用作,當作普通request處理就可逸樂。

Flex HTTPService 提交表單

方法1 採用urlvariables物件 import mx.controls.alert import mx.rpc.events.resultevent 對提交給後台的引數進行utf 8的編碼處理 方法2 採用,同時也演示了mx state的用法,來自網上 import mx.rpc.event...

html表單提交

用來收集資訊 form中的屬性 action 提交的路徑 method get post提交表單的方式 標籤type屬性的不同的值所表示的含義 text 文字框 value表示文字框中的值 readonly表示唯讀,可以寫readonly或true disable表示標籤不可用,可以寫disable...

form表單提交

表單的enctype屬性 enctype 屬性規定在傳送到伺服器之前應該如何對表單資料進行編碼。value 值 描述在傳送前編碼所有字元 預設 multipart form data 不對字元編碼。在使用包含檔案上傳控制項的表單時,必須使用該值。text plain 空格轉換為 加號,但不對特殊字元...