$ .getJSON()在chrome中失败但在ie中工作正常

时间:2013-10-21 12:09:46

标签: ajax internet-explorer google-chrome rest call

$.getJSON(loginURL,
                            {
                            });
                    $.ajax({
                        type: "GET",
                        dataType: "json",
                        headers: {Accept: "application/json"},
                        crossDomain: false,
                        url: loginURL,
                        success: function(loginFlag)
                        {



                        },
                        error: function(xhr, textStatus, errorThrown)
                        {


                        }
                    }
                    );

使用上下文名称和服务器需要处理的参数来配置loginURL。该调用在ie中工作正常,但在chrome中失败。当我尝试使用chrome时调用getJson的错误方法,但尝试使用ie时调用成功。 例如:var loginURL =“/ GameApplicationWeb_v4 / service / checkusercredentials / uname / name / password / name @ game”

1 个答案:

答案 0 :(得分:0)

$.getJSON(loginURL,
                            {
                            });
                    $.ajax({
                        type: "GET",
                        dataType: "json",
                        headers: {Accept: "application/json"},
                        crossDomain: false,
                        url: loginURL,
                        async: false,
                        cache: false,
                        success: function(loginFlag)
                        {
                        }, 
                        error   ()
                         {
                         });

我添加了一些标题属性(aync和amp; cache),现在它工作正常。