小编Mas*_*ked的帖子

如果URL包含阿拉伯字符,则Ajax在IE中不起作用

在我的Blogger网站中,我从JSON Feed加载帖子,JSON链接如下所示.

    http://technopress-demo.blogspot.com/feeds/posts/default/-/LABEL NAME?alt=json-in-script&max-results=5
Run Code Online (Sandbox Code Playgroud)

这是我用来从上面的URL获取帖子的代码.

    $.ajax({url:""+window.location.protocol+"//"+window.location.host
    +"/feeds/posts/default/-/"+LABEL NAME
    +"?alt=json-in-script&max-results=5",
    type:'get',dataType:"jsonp",success:function(data){}
Run Code Online (Sandbox Code Playgroud)

问题是,当我用阿拉伯语标签更改"LABEL NAME"时,帖子没有加载.我用英文标签测试它,它工作正常,但我有阿拉伯语的问题.我试过这个来解码URL,但它没有用.

    $.ajax({url:""+window.location.protocol+"//"+window.location.host
    +"/feeds/posts/default/-/"+encodeURIComponent(LABEL NAME)
    +"?alt=json-in-script&max-results=5",
    type:'get',dataType:"jsonp",success:function(data){}
Run Code Online (Sandbox Code Playgroud)

这是问题的现场演示.

ajax jquery internet-explorer json

8
推荐指数
1
解决办法
585
查看次数

标签 统计

ajax ×1

internet-explorer ×1

jquery ×1

json ×1