简体   繁体   中英

HTTPS issue with ajax call in javascript

I am calling a webservice using ajax call(javascript) to return json.It is working fine.But when i changed my site to HTTPS it is not working.What will be the reason?

function GetReportguid1, callback) { 
 $.ajax({
       type: "POST",
       url: "/demo/Datapage.aspx/GetData",
       contentType: "application/json; charset=utf-8",
       dataType: "json",
       data: JSON.stringify({
           guiddemo: guid1           
       }),
       success: function (results) {          
           callback(results);
       },
       error: AjaxFailed
   });


};

Add the Access-Control-Allow-Origin header from the server

Access-Control-Allow-Origin: https://www.yoursite.com

http://en.wikipedia.org/wiki/Cross-Origin_Resource_Sharing

And try use JSONP instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM