亚洲最大看欧美片,亚洲图揄拍自拍另类图片,欧美精品v国产精品v呦,日本在线精品视频免费

  • 站長資訊網(wǎng)
    最全最豐富的資訊網(wǎng)站

    jquery post中文亂碼怎么辦

    jquery post中文亂碼的解決辦法:1、前臺post請求的時候?qū)Πl(fā)送的數(shù)據(jù)進(jìn)行【encodeURIComponent()】編碼;2、后臺用【UTF-8】轉(zhuǎn)譯。

    jquery post中文亂碼怎么辦

    • 該方法適用于所有品牌電腦

    jquery post中文亂碼的解決辦法:

    前臺post請求的時候?qū)Πl(fā)送的數(shù)據(jù)進(jìn)行encodeURIComponent()編碼

    例如:

    var transactType= $("#transactType").attr("value"); var content=encodeURIComponent($("#content").html()); var title=encodeURIComponent($("#title").val()); $.post(       "${path}/transact!addTransact.action",  {"content":content,"title":title},  function(data){            if(data=='1'){                alert("保存成功!");                DG.cancel();             }else{                alert("保存失敗!");           } } );

    后臺:

    UTF-8轉(zhuǎn)譯

    transactType = URLDecoder.decode(getStringParameter("transactType"),"UTF-8"); content =  URLDecoder.decode(getStringParameter("content"),"UTF-8"); title =  URLDecoder.decode(getStringParameter("title"),"UTF-8");

    即可解決jQuery post請求中文亂碼問題。

    相關(guān)學(xué)習(xí)推薦:js視頻教程

    贊(0)
    分享到: 更多 (0)
    網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號