php - esponse to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin'


hi i am using jquery ajax method to get accces to login token but getting this message

Failed to load Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '



         headers: {

        "Accept" :'application/json'   //If your header name has spaces or any other char not appropriate
            url: '',
             contentType: "application/json; charset=utf-8",
    type: 'post',dataType: "post",data:JSON.stringify( {username  :'demo',  password  :'demo'}),
        crossDomain: true, 

        success: function(resuklt){

     [enter image description here][1]



Please use ...

dataType: 'jsonp',  //use jsonp data type in order to perform cross domain ajax
  crossDomain: true,

before succes function..

People are also looking for solutions to the problem: php - How to make cart & checkout page calculation in opencart


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.