因为采用data:字符串这种形式,+和&是jquery分隔参数的分隔符,所以会丢失,解决方法就是把text文本中的+和&替换掉,用js里面的encodeURIComponent编码,为了省事,直接写出编码替换..
function
FixJqText(str) {
var tempstr = str.replace( / \+ / g, " %2B " );
tempstr = tempstr.replace( / \& / g, " %26 " );
return tempstr;
}
var tempstr = str.replace( / \+ / g, " %2B " );
tempstr = tempstr.replace( / \& / g, " %26 " );
return tempstr;
}
引申:js里面的编码方式: escape , encodeURI ,encodeURIComponent
最好使用json的格式:{"abc":"cde","efg":123}