开发者

Access-Control-Allow-Origin. Error Help

Hey guys When I requested ajax request a web service I m gettig this error with this code.. But Not every computer just laptops :) I don't understand... it works with desktop computer

ajax request from this site http://www.mozturk.somee.com/main.html

XMLHttpRequest cannot load http://www.mozturk.somee.com/icerik.asmx/makaleGetir. Origin http://www.mozturk.somee.com is not allowed by Access-Control-Allow-Origin. $.ajax({

            type: 'POST',
            url: 'http://www.mozturk.somee.com/icerik.asmx/makaleGetir',
            data: JSON.stringify(json),
            contentType: 'application/json; charset=utf-8',
            dataType: 'json',
            cache: false,
            success: function (results) {

            },
            error: function () {
                alert('Bağlantı sırasında bir sorun oluştu. Yeniden deneyin');
            }

    开发者_Python百科    });


You are almost certainly misdiagnosing the problem and testing:

  • http://mozturk.somee.com/main.html on the laptops
  • http://www.mozturk.somee.com/main.html on the desktop.

Since you use an absolute URI in the request, you end up mixing origins.

Use a relative URI instead.

(I also suggest you pick either mozturk.somee.com or www.mozturk.somee.com to be canonical and redirect all the traffic from the other to it).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜