jquery ajax 文本丢失加号和连接号的问题

因为采用data:字符串这种形式,+和&是jquery分隔参数的分隔符,所以会丢失,解决方法就是把text文本中的+和&替换掉,用js里面的encodeURIComponent编码,为了省事,直接写出编码替换..

function FixJqText(str) {
    var tempstr = str.replace(/\+/g, "%2B");
    tempstr = tempstr.replace(/\&/g, "%26");
    return tempstr;
}

 

posted @ 2013-04-14 14:30  firesnow  阅读(292)  评论(0编辑  收藏  举报