URL拼接中文在IE瀏覽器下造成的 Error parsing HTTP request header The valid characters are defined in RFC 7230 and RFC 3986
阿新 • • 發佈:2018-11-30
1 var isDelay=$("#fieldCodeYes_IS_DELAY_BID").val(); 2 $("#saveFrm").attr('action','/ebidding/bulletin/ChangeBulletin/submitModifyBulletin.htm?no_sitemesh'+ 3 '&v([email protected])='+isDelay); 4 $("#saveFrm").submit();
使用以上程式碼提交Submit時,後臺報Error parsing HTTP request header錯誤(可能是其它問題,還要看詳細錯誤
詳細錯誤是The valid characters are defined in RFC 7230 and RFC 3986。只有IE瀏覽器會出現這個錯誤,其他瀏覽器核心正常執行。
意思就是無法轉義某些中文符號。
解決辦法:encodeURI(轉義中文字元)
var isDelay=$("#fieldCodeYes_IS_DELAY_BID").val(); $("#saveFrm").attr('action',encodeURI('/ebidding/bulletin/ChangeBulletin/submitModifyBulletin.htm?no_sitemesh'+ '&v([email protected])='+isDelay));
$("#saveFrm").submit();