开发者

ajax request returning script tag-- mootools

I'm seeing a weird error in one of my ajax-updated pages.

The request looks like this:

var a = new Ajax(url,{
    method: 'get',
        onComplete: function( response ){
            $('loader').style.display="none";
            readData( response );
        }
    });
    a.request();
    return;

This works fine on almost any system so far, but on a new server it breaks, with a mootools error "unknown XML entity". The weird part is, if you trace the request with 开发者_如何学JAVAfirebug, rather than returning JSON as expected, the response body looks like this:

<script>document.location.href='http://www.mysite.com?myparams=value&etc;</script>

However, if you actually make that request manually by pasting the URL in the script tag (response body) along with the params in a browser, the proper JSON data is returned.

Any ideas why the request would return a script tag instead of the data?


As Dimitar suggested in the comments above, this was an issue in a Joomla site thanks to a URL rewrite tool called sh404SEF. According to the developer, the fix is to set the "301 redirect" parameter to "no" in the advanced configuration options.

So this had nothing to do with my code or the ajax functions, but was rather the SEF rewrite component that was breaking the request.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜