This article describes the solution to the garbled Chinese parameters in JS pass values. Share it for your reference, as follows:
function PopupFK(cNum,type){ var url = "contract!Paying.action"; url = url + "?contract.contractNum="+cNum+"&payingType="+type;// if(isEmpty($(_this).attr("payId"))){// url = url + "&s_paymentId="+paymentId;// url = url + "&s_paymentDtlId="+paymentDtlId;// }else{// url = url + "&s_payId="+$(_this).attr("payId");// } url = url+"&random="+Math.random(); //Here. Use encodeURI to transcode twice. When the background action is received. In progressing once. There will be no garbled url = encodeURI(url); url = encodeURI(url); var ret = window.showModalDialog( url, "", "dialogWidth=950px;dialogHeight=600px;center=yes;border=thick;status=no;help=no;scrollbars=no" );}Below is the Action code snippet
String cNum = contract.getContractNum();String Num;try { Num = URLDecoder.decode(cNum,"utf8"); System.out.println(Num); c = csl.queryOneByNum(Num);} catch (UnsupportedEncodingException e) { throw new RuntimeException("Contract data error, please contact the administrator");}For more information about JavaScript related content, please check out the topics of this site: "Summary of JavaScript value transmission operation skills", "Summary of JavaScript encoding operation skills", "Summary of json operation skills in JavaScript", "Summary of JavaScript switching effects and techniques", "Summary of JavaScript search algorithm skills", "Summary of JavaScript animation effects and techniques", "Summary of JavaScript errors and debugging techniques", "Summary of JavaScript data structures and algorithm skills", "Summary of JavaScript traversal algorithms and techniques" and "Summary of JavaScript mathematical operations usage"
I hope this article will be helpful to everyone's JavaScript programming.