Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70748

Ionic http request to php server cause CORS error

$
0
0

@pdj wrote:

has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

    let body = new FormData();
    let head=new Headers();
    var header = { "headers": {"Content-Type": "application/json"} };
    var options = new RequestOptions();
    options.headers = new Headers();
    options.headers.append('Content-Type', 'application/json');
    options.headers.append('X-Requested-With', 'XMLHttpRequest');
    body.append('cmd', "get_page_ad_list");
    body.append('page_idx','1');
    body.append('code', "wouienfjnfyen3wf42hnlks#$@#23");
    console.log(body);
    this.http.post('http://seoul7209.cafe24.com/api/api.php',body,options).subscribe((r)=>{
      window.alert(r);
      console.log(r);
    })

I added server code header(“Access-Control-Allow-Origin: *”);
but having same error…

how can I solve problem…

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70748

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>