Results 1 to 5 of 5

Thread: I canít work with API with JavaScript

  1. #1

    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,588
    Why would you want to use js? SC limit the IP addresses you can request from, so you cant make the request client side
    Various data posts: Who plays what? CWL data 1 (stars), 2 (3* rates), 3 (rosters), 4 (start times and other) Data at end of old Legends And (non-data) how max bases are ordered in war
    --------------------
    Forum cup organiser. The forum cup discord server is: https://discord.gg/KEUxV2e

  3. #3
    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
    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
  •