json - Jquery-No 'Access-Control-Allow-Origin' header is present on the requested resource -


i have request json data other website, meets problem of access control allow origin in header, have no idea how set access control allow origin in header, i'm put source code in iis8 access json data iis8 api source.

$.ajax({     type: "get",     url:rooturl,     xhrfields: {         withcredentials: false     },      headers: {       "access-control-allow-origin: ": "*",       "access-control-allow-methods: ": "get",       "access-control-allow-headers: ": "authorization",     },     datatype: "json",     success: function(data) {        },     error: function() {         alert("an error occurred while processing json file.");     } });      

these should in server, not client:

"access-control-allow-origin: ": "*", 

to implement in server, php:

<?php   header("access-control-allow-origin: *"); 

for asp.net:

response.appendheader("access-control-allow-origin", "*"); 

for others, check i want add cors support server more information.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -