0

I already went ahead and read all the possible answers, and I have definitely tried adding

         header("Access-Control-Allow-Origin : *");

to the top of my asp page. but didn't solve the problem.

 jQuery(document).ready(function(){
        $.post('http://www.ike.co.kr/index.asp',
               function(pageContent) {
jQuery('.main_left_content_1').load('http://www.ike.co.kr/index.asp .ike_notice');


});});

Here is the ajax call im using.

Of course, all the files are under the one domain, in the same ftp server.

can anyone give me an thorough explanation whay this doesn't work and how to fix it?

Mark Kang
  • 131
  • 1
  • 1
  • 14
  • Either enable cors or use server side proxy. – Jai Dec 31 '15 at 07:40
  • why the **.ike_notice** in `'http://www.ike.co.kr/index.asp .ike_notice'`? – Wesley Smith Dec 31 '15 at 07:46
  • 2
    @DelightedD0D — *The .load() method, unlike $.get(), allows us to specify a portion of the remote document to be inserted. This is achieved with a special syntax for the url parameter. If one or more space characters are included in the string, the portion of the string following the first space is assumed to be a jQuery selector that determines the content to be loaded.* — http://api.jquery.com/load/ – Quentin Dec 31 '15 at 07:48
  • 2
    Isn't `header("Access-Control-Allow-Origin : *");` PHP syntax and not Classic ASP syntax? Well, it could be a language used in Classic ASP but I'm pretty sure that there isn't a `header` method and that you use something else to set response headers. It certainly hasn't added the header required: https://www.evernote.com/l/AAO8Tf51s2tFUq1Iz_DOGcUQtYxnSZVFFy8 (unless there's a bunch of conditional stuff around it I don't know about). – Quentin Dec 31 '15 at 07:49
  • @Quentin thank you, honestly, I've always used `$.get()` and did not realize that was possible – Wesley Smith Dec 31 '15 at 07:52
  • "all the files are under the one domain" — What is the URL of the page you are running the JavaScript in? – Quentin Dec 31 '15 at 07:55
  • @Quentin it's http://www.ike.co.kr/English/main.html – Mark Kang Dec 31 '15 at 08:00
  • @MarkKang — How about putting both pages on `ike.co.kr` or on `www.ike.co.kr` instead of splitting them across two subdomains? – Quentin Dec 31 '15 at 08:01
  • @Quentin if you mean putting the both index.asp and main.html on the same folder, i already have tried that. and thanks for letting me know that it doesn't work on asp. but now im lost. – Mark Kang Dec 31 '15 at 08:03
  • 1
    No. That isn't what I mean. I mean being consistent about putting a `www.` or not in the hostname. – Quentin Dec 31 '15 at 08:05
  • @Quentin for some reason, the chrome console spits http://ike.co.kr without www. in front, and i don't know how to fix this. – Mark Kang Dec 31 '15 at 08:12
  • It outputs whatever you type in the first place. – Quentin Dec 31 '15 at 08:12
  • Funnything about this is that, it works fine when accessed by my own computer. but when accessed by anything else, it prints that error. if anybody have an idea of how to fix this, i'll appreciate if you let me know. – Mark Kang Dec 31 '15 at 08:15
  • 1
    oh. i figured it out. it only works when i put www. in front of the address. – Mark Kang Dec 31 '15 at 08:16
  • @Quentin thanks for the answers! – Mark Kang Dec 31 '15 at 08:25

1 Answers1

-2

It's a built-in protection, to disallow running JavaScript on remote servers.

You must be running script from one port of your server, to content on another port?

In that case, it can't be done. You need the same server as well as the same port.See this link. This is the error you must be getting. As a programmer, there isn't anything you can do, really.

Community
  • 1
  • 1
cst1992
  • 3,823
  • 1
  • 29
  • 40