Ajax,响应主体为空

I try to get data from server http://someserver12345.com If i download it for example with C# DownloadString or open it in browser it returns body with data and from FireBug's log Content-Length is equal to data's size. So all results are ok; For example response data can be json documents and by opening in browser each time server returns json document;

But when i try to get data with jQuery GET request then Content-Length is still correct, but data is empty!!!

This is my code:

<script src="http://code.jquery.com/jquery-latest.min.js"></script>    
<script>
    $(document).ready(function() {

        $.ajaxSetup({
            beforeSend: function(request) {
                request.setRequestHeader('Accept', 'application/json');
            }
        });

        $.ajax({
            type: 'GET',
            url: 'http://someserver12345.com',
            success: callback
        });

        function callback(data, status) {
            alert(data);
            //$('div').text(data);
        }

    });
</script>

I found that data is not null object in callback function;

I am new in this, help me please;) Any ideas and advices will be cool!;)

Thank you!!!

查看全部
weixin_33749242
weixin_33749242
2010/10/14 17:04
  • http
  • ajax
  • jquery
  • 点赞
  • 收藏
  • 回答
    私信

1个回复