
Hello guys, I'm very new to this, and need your help

What I need is very simple: check whether a site is online or offline. The question is that
the site is where the web application is running so i need to do it asynchronous.
I've tried it in many ways, but I can't get it working:
E.g.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="jquery.js"></script>
<script>
var req = function (server) {
$.ajax({
url : server ,
success : function () {
alert('Pinging');
}
,error : function () {
alert('Not pinging');
}
});
};
</script>
</head>
<body>
<a href="javascript:" onclick="req('http://www.google.com');">Go!</a>
</body>
</html>
Can you please give me a water clear example of how I can get it working?
Best Regards,
Daisy.