ajax使用POST傳遞引數

2021-04-15 13:00:55 字數 1050 閱讀 3035

下邊是我找到的乙個例子http://jeremy-lee.blog.sohu.com/63843765.html

post.html:

function alertcontents() else }}

function get(obj)

server-response:

post.php

<?

print_r(下邊是我找到的乙個例子

post.html:

function alertcontents() else }}

function get(obj)

server-response:

post.php

___fckpd___1

update from visitor "ar200r" - thank you very much

if we use "&" character it wont work...

but if we use escape();

var poststr = "mytextarea1=" + escape(encodeuri(

document.getelementbyid("mytextarea1").value ))

+"&mytextarea2=" +

escape(encodeuri( document.getelementbyid("mytextarea2

").value ));

and next in php u use urldecode , it will work good.

post);

?>

update from visitor "ar200r" - thank you very much

___fckpd___2

使用Ajax傳遞post請求引數

post請求必須在請求報文中明確設定請求的型別 xhr.setrequestheader content type post請求要寫在send方法裡 post請求要把請求引數寫在send方法中 xhr.send parase doctype html en utf 8 viewport conten...

使用post方式傳遞URL引數

遇上用url方式傳參發現url超長了。只好用post方式傳。函式如下 function post url,params temp.submit return temp 呼叫如下 var params post pm report exportanddownloadpmanalysisinfo.act...

ajax指定post傳遞資料

1 ajax fchydrant presubmit 5 data 6 success function rtn 14 15 當前臺使用 ajax傳遞資料時,如果不指定type型別,會預設使用get方式提交,這時會將data裡的資料轉成字串格式拼接在request url後面,如果data裡的資料長...