JSFiddle - React, Tailwind, and code Playground

by adamzr

HTML

<a href="http://www.example.com" onclick="check(this)">Click this Link</a>
<span id="result"></span>

JavaScript

$("a").click(function(event){
   event.preventDefault();
   var url = $(this).attr("href");
   alert(url);
   xmlHttp.open("GET", url, true);
   xmlHttp.onreadystatechange=function(){

    if(xmlHttp.readyState==4){

       if (xmlHttp.status==200) 
       {
         window.location.href="http://www.google.com";
         alert("Page  Available");
       }
       else 
       {
         window.location.href= "http://www.google.com";
       }
    }
  }

  xmlHttp.send(null);
  return false;
});