I'm trying to find a function that return HTTP Status Code from an URL, and then "make something" based on the returned statuses (404, 416, 200 etc...)
Can someone help me? I've tried the other functions posted here on StackOverflow but anyone was usefull for my purpose.
I need to integrate this function inside my PlayFramework web-app.
Thanks a lot
I'm trying to find a function that return HTTP Status Code from an URL, and then "make something" based on the returned statuses (404, 416, 200 etc...)
Can someone help me? I've tried the other functions posted here on StackOverflow but anyone was usefull for my purpose.
I need to integrate this function inside my PlayFramework web-app.
Thanks a lot
Share asked Mar 17, 2015 at 11:23 FabioFabio 1591 gold badge4 silver badges13 bronze badges 1- if using jquery, this is the answer : stackoverflow./a/8571617/724913 – arkoak Commented Mar 17, 2015 at 11:28
1 Answer
Reset to default 1Can you try the following ..?
function getStatus(url) {
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
if (request.readyState === 4){
request.status;//this contains the status code
}
};
request.open("GET", url , true);
request.send(null);
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744907695a4600356.html
评论列表(0条)