JQuery字符编码问题

时间:2014-03-31 17:22:27

标签: jquery ajax encode url-encoding

我的jquery代码是通过AJAX发送编码的字符,这些字符在我的服务器端出错,因为我在使用的CMS中不支持它们。有没有办法可以发送确切的字符而不是ASCII值。我需要字符集吗?

以下是查询中传递的内容

?search_query=new%2Bcommunity%26fq%3Dtype%3Aboard

预期

?search_query=new+community&fq=type:board

Ajax代码

其中kb_endpoint_url是我正在点击的api,其中queryValue为 q = ,这是新社区,参数为参数字符串,即& fq = type :板

$.getJSON( "${kb_endpoint_url}", { search_query : queryValue+parameters } )
    .done(function( data, xhr, status, error) {
        console.log(data);
        //code here
    })              
    .fail(function(xhr, status, error){
        console.log(status); 
    })
    .always(function() {
        console.log("finished");
    });  

0 个答案:

没有答案