开发者

Why does my $.ajax load - then cancel?

开发者 https://www.devze.com 2023-01-31 15:35 出处:网络
I am using a rather rubbish ecommerce platform which is a bolt on from a ePoS system, so the functionality is limited - hence why I have to use silly hacks like these. Basically the default login page

I am using a rather rubbish ecommerce platform which is a bolt on from a ePoS system, so the functionality is limited - hence why I have to use silly hacks like these. Basically the default login page is un-styleable as there are no unique classes or ids on the TABLES - YES TABLES.

So I had this bright idea:

  if(window.location.href == "http://precisionoutdoors.web-epos.com/index.html?action=login"){    $('#central table').remove();    $('#central').load('http://www.precisionfiles.co.uk/inc/login.html');      }

This would strip out the rubbish form 开发者_开发问答and load my own custom one, however the page loads in firebug with status 'OK' but turns red, and doesnt load my data. Im really stuck for ideas on this one, so any would be deeply appreciated!


Looks like you're running into the Same Origin Policy. If you're in control of these resources, you should arrange things so both the original page and the one you're trying to load are on the same host (and protocol).

ORIGINAL: http://www.example.com/something
          -> Cannot load from http://www.another.com/somethingelse
          -> Can load from http://www.example.com/somethingelse


Looks like a cross domain AJAX issue. You're going to want to configure your server to accept requests from http://precisionoutdoors.web-epos.com. See:

  • W3C Cross Origin Resource Sharing
  • Mozilla HTTP access control
  • Cross-domain Ajax with Cross-Origin Resource Sharing by Nicholas Zakas
0

精彩评论

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