1

I am using the postman rest client on Brackets. Using that client I can request the Gogs api. But if I want to request it using jquery I get a:

XMLHttpRequest cannot load http://xxx.xxx.xxx.xxx:3000/api/v1/repos/.../.../issues?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.

This is my js code:

     var request = $.ajax({
        url: apiUrl+'repos/.../.../issues?token='+token,
        method: "GET",
        dataType: "json",
        crossDomain: true
    });

    request.done(function( data ) {
      resolve('it works', data);
    });

    request.fail(function( jqXHR, textStatus ) {
        reject(jqXHR, textStatus);
    });

Any ideas how to solve this problem?

Edit: At the moment it is only for developement. Therefore I can use this Chrome extension: Allow-Control-Allow-Origin: *

Wikunia
  • 1,564
  • 1
  • 16
  • 37

0 Answers0