Why does this jQuery Ajax call fail ONLY in IE9 (Even works fine in IE8 and IE7)

后端 未结 2 1076
余生分开走
余生分开走 2021-01-02 05:44

I have a website where I make an ajax call like this:

            // perform an ajax request to generate a new subscriber account
            jQuery.ajax({
          


        
2条回答
  •  清歌不尽
    2021-01-02 06:28

    Well I finally tracked down the problem. It turns out that for some reason jQuery/IE does not correctly urlencode double quotes. The URL of the request was:

    /search.json?callback=jQuery16105234487927080267_1313510362362&q=stocks OR "stock market" -blueprint -empireavenue.com -learn&_=1313510362469

    In every other browser by the time jQuery performed the ajax request it looked like:

    /search.json?callback=jQuery16105234487927080267_1313510362362&q=stocks%20OR%20%22stock%20market%22%20-blueprint%20-empireavenue.com%20-learn&_=1313510362469

    but for whatever reason in all versions of IE it came out like this:

    /search.json?callback=jQuery16105234487927080267_1313510362362&q=stocks%20OR%20"stock%20market"%20-blueprint%20-empireavenue.com%20-learn&_=1313510362469

    which caused the server to return no data.

提交回复
热议问题