Click here to Skip to main content
15,939,960 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
checkTicker()
function checkTicker() {
  var dao = new XMLHttpRequest();

 //dao.open("GET", "https://api.fanyi.baidu.com/api/trans/vip/translate?q=hello&from=en&to=zh&appid=20171120000097357&salt=1435660288&sign=bcd4bc3fe3b120dddea66560f8533891",true);

  dao.open("GET", "https://poloniex.com/public?command=returnTicker", true);

  document.write("===111===") 
  dao.onreadystatechange = function() 
  {
        document.write("==222==") 
        document.write(dao.status) 

  }
  dao.send();
}


What I have tried:

if i use url "poloniex.com" to get json, not problem, and "dao.status" is 200;

but if i use url "baidu" to get json, get nothing , and "dao.status" is 0;

all of this 2 url can get json in chrome .

why url baidu can not get json, and how to do ?
Posted
Updated 23-Nov-17 3:55am
Comments
F-ES Sitecore 23-Nov-17 10:41am    
Use the browser's network tools to examine the network call and look for any errors that are returned.

1 solution

There is no way anyone here is going to know this. We don't control the code behind those URL's.

You have to contact the people who own those URL's to find out what has to be submitted in your request, including anything that has to be in the headers of your request, in order for the server to understand your query and how to return the response.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900