国产99久久精品_欧美日本韩国一区二区_激情小说综合网_欧美一级二级视频_午夜av电影_日本久久精品视频

最新文章專題視頻專題問答1問答10問答100問答1000問答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當前位置: 首頁 - 科技 - 知識百科 - 正文

AJAX 異步傳輸數(shù)據(jù)的問題

來源:懂視網(wǎng) 責編:小采 時間:2020-11-27 22:52:35
文檔

AJAX 異步傳輸數(shù)據(jù)的問題

AJAX 異步傳輸數(shù)據(jù)的問題:要異步傳輸?shù)臄?shù)據(jù): Xml代碼 .... <action xsi:type=basic:JavaScript script=index += 1;/> .... Ajax異步傳輸代碼: Js代碼 代碼如下:var postData = input=+ escape(inputJSON) +&script=
推薦度:
導讀AJAX 異步傳輸數(shù)據(jù)的問題:要異步傳輸?shù)臄?shù)據(jù): Xml代碼 .... <action xsi:type=basic:JavaScript script=index += 1;/> .... Ajax異步傳輸代碼: Js代碼 代碼如下:var postData = input=+ escape(inputJSON) +&script=

要異步傳輸?shù)臄?shù)據(jù):
Xml代碼
....
<action xsi:type="basic:JavaScript" script="index += 1;"/>
....
Ajax異步傳輸代碼:
Js代碼
代碼如下:
var postData = "input="+ escape(inputJSON) +"&script="+escape(xml)+
"&feedGeneral=" + escape(feedGeneral);
XmlHttpRequest.open("POST",url,true);
XmlHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
XmlHttpRequest.send(postData);

postData在encode和unencode,最終導致在后臺Servlet中得到得到數(shù)據(jù)+被空格代替,使得script中的index += 1;變成了index = 1;從而導致后臺Java代碼在跑script出現(xiàn)死循環(huán)。
在網(wǎng)上搜索,發(fā)現(xiàn)content-type使用application/x-www-form-urlencoded后:
[來自http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1]寫道
代碼如下:
Control names and values are escaped. Space characters are replaced by `+', and then reserved characters are escaped as
described in [RFC1738], section 2.2: Non-alphanumeric characters are replaced by `%HH', a percent sign and two hexadecimal
digits representing the ASCII code of the character. Line breaks are represented as "CR LF" pairs (i.e., `%0D%0A').

然而使用form來提交方式來發(fā)起request卻不會出現(xiàn)類似的問題,而form默認的Content-Type也是application/x-www-form-urlencoded:
Js代碼
代碼如下:
$('test').innerHTML = "<form target='_blank' id='test_form' action='./gen_feed' method='post'>"
+ "<input type='text' name='input' /><input type='text' name='script' />"
+ "<input type='text' name='feedGeneral' /><input type='hidden' name='format' value='" + this.feed_type + "'
/>"
+ "<input type='submit' value='gen' /></form>";
var test_form = $('test_form');
test_form.elements[0].value = inputJSON;
test_form.elements[1].value = script;
test_form.elements[2].value = feedGeneral;
test_form.submit();

仍未發(fā)現(xiàn)問題到底出在何處,暫做備忘。暫時把script中的‘+'都用‘-'代替,index += 1;改成index -= -1;呵呵,以后有人看到這段自動生成的詭異腳本,不知道會作何感想,但現(xiàn)在也只能如此。

聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

AJAX 異步傳輸數(shù)據(jù)的問題

AJAX 異步傳輸數(shù)據(jù)的問題:要異步傳輸?shù)臄?shù)據(jù): Xml代碼 .... <action xsi:type=basic:JavaScript script=index += 1;/> .... Ajax異步傳輸代碼: Js代碼 代碼如下:var postData = input=+ escape(inputJSON) +&script=
推薦度:
  • 熱門焦點

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 在线日韩视频 | 久久99久久精品国产99热 | 亚洲综合一区二区三区 | 国产精品国产三级国产 | 国产美女视频黄a视频全免费网站 | 亚洲 欧美 日韩 另类 | 欧美三级经典电影在线观看 | 亚洲欧美韩日 | 亚洲一区 中文字幕 | 国产亚洲午夜精品a一区二区 | 一级毛片免费下载 | 日韩视频网| 国产精品成人一区二区 | 精品国产欧美一区二区三区成人 | 伊人精品成人久久综合欧美 | 鸣人x钢手| 国产成人一区二区三区免费观看 | 国产91精品一区二区视色 | 看毛片的网站 | 欧美视频区 | 国产成人精品一区二三区在线观看 | 国产日韩欧美91 | 国产欧美va欧美vahd | 免费看男女做好爽好硬视频 | 欧美日韩一区二区三区久久 | 自拍偷拍欧美亚洲 | 91视频一区 | 国产欧美91 | 精品国产96亚洲一区二区三区 | 国产在线精品一区二区三区不卡 | 制服一区 | 天天做天天爱夜夜爽毛片毛片 | 久久一区二区三区免费 | 国产精选在线视频 | 日韩视频一区二区在线观看 | 国产日韩欧美一区二区三区视频 | 高清 国产 日韩 欧美 | 日韩在线专区 | 日本成人一区二区 | 亚洲综合精品一区二区三区中文 | 亚洲精品国产精品乱码不97 |