Results 1 to 5 of 5

Thread: I can’t work with API with JavaScript

  1. #1
    Fresh Spawn
    Join Date
    Jul 2019
    Posts
    2

    I can’t work with API with JavaScript

    I make Ajax request, but I get an error "has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource". What is the reason? I tried to work with php, everything works fine, but when I rewrite the code in javascript an error appears. I was looking for similar errors in the forum, but I did not find any practical answers.
    Can someone help?

  2. #2

    Join Date
    Sep 2014
    Location
    Digging another tunnel in the data mine
    Posts
    6,752
    Why would you want to use js? SC limit the IP addresses you can request from, so you cant make the request client side

  3. #3
    Fresh Spawn
    Join Date
    Jul 2019
    Posts
    2
    Quote Originally Posted by OnyxDS View Post
    Why would you want to use js? SC limit the IP addresses you can request from, so you cant make the request client side
    Because I do not know php. Through JS, it's much more convenient for me to work. And since the SC server does not support CORS, then I still have to learn php

  4. #4
    New Bloke/Chick
    Join Date
    Feb 2016
    Posts
    45
    PHP is very easy to learn. A big documentation in MANY languages.

  5. #5
    Centennial Club RepeaterCreeper's Avatar
    Join Date
    Jan 2015
    Location
    United States
    Posts
    123

    Node JS

    Quote Originally Posted by Buksirchik View Post
    Because I do not know php. Through JS, it's much more convenient for me to work. And since the SC server does not support CORS, then I still have to learn php
    If you really want to use JS you can use Node. There's plenty of wrappers out there to help you with using Node.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •