jquery - how to allow insecure content to be displayed on page -


i trying make ajax request external url , try json data url. getting 401- authorization error saying insecured content when try access url. here below code. please advise

function check() {      var env_url = 'http://../bluelight/api/bluelights/getactivebluelight';        $('#trbluelight').hide();     $.getjson(env_url+"&callback=?", function (data) {         if (data.expdate != null) {             $('#trbluelight').show();         } else {             $('#trbluelight').hide();         }     });     } 

so long comment. assume create following file proxy_loader.php , put webservers root directory (normaly httpdocs). must accessible https://domain.tdl/proxy_loader.php

the file should this:

<?php  // url provided javascriot $url= $_get['url'];  // initialize curl $ch = curl_init();  // additional headers session id etc. $header = '';  // optional user & password $userpass = 'user:password';  //$parameters request // use parameter name array key // use parameter value array value $param = array();  // set url curl_setopt($ch, curlopt_url, $url); //this enables output variable curl_setopt($ch, curlopt_returntransfer, true); // set optional header curl_setopt($ch, curlopt_httpheader, $headers); // set request method curl_setopt($ch, curlopt_customrequest, "get"); // optional http authenfication // remove // enable // curl_setopt($ch, curlopt_userpwd, $userpass); curl_setopt($ch, curlopt_postfields, $param);  // execute request // , save response in $ret $ret = curl_exec($ch);  // close connection curl_close($ch);  echo $ret;  // maybe must use this: // echo json_encode($ret); ?> 

now request url through server using function this:

function check() {      var env_url = 'http://../bluelight/api/bluelights/getactivebluelight';         $('#trbluelight').hide();      $.getjson('/proxy_loader.php?url=' + env_url, function (data) {         if (data.expdate != null) {             $('#trbluelight').show();         } else {             $('#trbluelight').hide();         }     }); } 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -