前台通过ajax方法异步调用后台生成的html代码,后台通过HttpUtility.encodeURI方法编码,前台通过js方法,decodeURIComponent方法解码,但是前台解码不能解析后台编码后的加号和空格。解决方法:后台直接用Microsoft.JScript.GlobalObject.encodeURIComponent(content)方法编码,前台用decodeURIComponent方法解码,完美解决加号问题。注:Microsoft.JScript.GlobalObject.encodeURIComponent所需得引用dll时Microsoft.JScript,dll,添加即可。
转载于:https://blog.51cto.com/gloden/1246194