Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call blocked: Origin 'null' is therefore not allowed access #44

Closed
pwFoo opened this issue Feb 7, 2017 · 1 comment
Closed

Call blocked: Origin 'null' is therefore not allowed access #44

pwFoo opened this issue Feb 7, 2017 · 1 comment

Comments

@pwFoo
Copy link

pwFoo commented Feb 7, 2017

Found #26 with the set header example

var request = ajax({
  headers: { 'content-type': null }
})

request.post(url, FormObj)
  .then(function (data) {
    // success
    console.log(data)
  })
  .catch(function (err) {
    // error
    console.log(err)
  })

Tried to add the header and send the call with one single ajax() method call.

      $.ajax({
            method: 'get',
            url: 'https://www.google.de'
        })
        $.ajax({
            method: 'get',
            headers: {
                'Access-Control-Allow-Origin': '*'
            },
            url: 'https://www.google.de'
        })

And geht errors:

without header

XMLHttpRequest cannot load https://www.google.de/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

and with header

XMLHttpRequest cannot load https://www.google.de/. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 405.

So maybe I tried it the wrong way? Could you help me with a hint about the problem?

@pwFoo
Copy link
Author

pwFoo commented Feb 7, 2017

Got it... server side problem ;)
No problem from the same origin...

@pwFoo pwFoo closed this as completed Feb 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant