R
R
Roman2019-06-28 10:46:26
JavaScript
Roman, 2019-06-28 10:46:26

Is there any way to bypass CORS without a proxy?

Hello.
The browser forbids the js script to take content from json from another server.
What to do?
(Script on Git Pages so don't raise the proxy)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
irishmann, 2019-06-28
@procode

Cors-proxy to use, example for JQUERY

$.ajax({
  type:'POST',
  url: 'https://cors-anywhere.herokuapp.com/http://************.ru/api/',
  data: { 
    query: '{"ask":"'+message+'","userid":'+id+',"key":"1"}'
  },
  success: function(data){
    msg = JSON.parse(data);
    $(".messages").append('<li><div class="text-msg receive_msg">'+msg['aiml']+'</div></li>');
    while($(".messages li").length > 7){
      $('li:first').detach();
    }
  }
});

L
Lynn "Coffee Man", 2019-06-28
@Lynn

It is forbidden.
You can use public proxies (google, they are), but I would not

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question