Ajax request with JQuery
Posted: Fri Apr 24, 2009 6:19 am
I just started learning jquery and I am trying to use the ajax functions, I made a test page which loads some data from a php file while showing a throbber in the process. Is there a way to make it so to be notified when the request fails?
Code: Select all
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//START
$("div").click(function(event){
$("#getcontent").html("<img src='throbber.gif' alt='Loading...' />");
$.get("test.php", function(data){
$("#getcontent").html(data);
});
});
//END
});
</script>
</head>
<body>
<div id='getcontent' width='343' height='333' style='background-color:red;height:333;'>test</div>
</body>
</html>