婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > AJAX 異步傳輸數(shù)據(jù)的問題

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

熱門標簽:電銷機器人違法了嗎 遼寧銀行智能外呼系統(tǒng) 姜堰電銷機器人 海南銀行智能外呼系統(tǒng)商家 遼寧正規(guī)電銷機器人 澳大利亞城市地圖標注 許昌智能電銷機器人公司 辰溪地圖標注 上海浦東騰訊地圖標注位置
要異步傳輸?shù)臄?shù)據(jù):
Xml代碼
....
action xsi:type="basic:JavaScript" script="index += 1;"/>
....
Ajax異步傳輸代碼:
Js代碼
復(fù)制代碼 代碼如下:

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,最終導(dǎo)致在后臺Servlet中得到得到數(shù)據(jù)+被空格代替,使得script中的index += 1;變成了index = 1;從而導(dǎo)致后臺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]寫道
復(fù)制代碼 代碼如下:

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代碼
復(fù)制代碼 代碼如下:

$('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)在也只能如此。
您可能感興趣的文章:
  • ajax.js里面有內(nèi)容顯示效果,根據(jù)ID
  • asp.net下 jquery jason 高效傳輸數(shù)據(jù)
  • 基于Jquery的跨域傳輸數(shù)據(jù)(JSONP)
  • JavaScript使表單中的內(nèi)容顯示在屏幕上的方法
  • JS實現(xiàn)左右拖動改變內(nèi)容顯示區(qū)域大小的方法
  • java編程實現(xiàn)基于UDP協(xié)議傳輸數(shù)據(jù)的方法
  • Python爬蟲抓取手機APP的傳輸數(shù)據(jù)
  • js實現(xiàn)內(nèi)容顯示并使用json傳輸數(shù)據(jù)

標簽:晉城 伊春 撫州 西藏 崇左 威海 銅川 深圳

巨人網(wǎng)絡(luò)通訊聲明:本文標題《AJAX 異步傳輸數(shù)據(jù)的問題》,本文關(guān)鍵詞  AJAX,異步,傳輸,數(shù)據(jù),的,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《AJAX 異步傳輸數(shù)據(jù)的問題》相關(guān)的同類信息!
  • 本頁收集關(guān)于AJAX 異步傳輸數(shù)據(jù)的問題的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 南木林县| 永宁县| 藁城市| 定陶县| 东宁县| 碌曲县| 丹东市| 绥化市| 鹿泉市| 十堰市| 洛浦县| 鄢陵县| 手机| 琼中| 四平市| 邯郸市| 高安市| 军事| 蚌埠市| 阿城市| 平安县| 连云港市| 成安县| 大港区| 申扎县| 黄大仙区| 长武县| 如东县| 龙口市| 翁牛特旗| 青铜峡市| 同仁县| 周宁县| 鹤庆县| 治县。| 蒲城县| 科技| 民丰县| 苗栗县| 凤翔县| 浠水县|