-
Notifications
You must be signed in to change notification settings - Fork 0
/
jqueryAjaxError.php
48 lines (43 loc) · 1.06 KB
/
jqueryAjaxError.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<script src="/sandbox/jquery-1.6.1.min.js" type="text/javascript"></script>
<script>
function butClick()
{
text=$(this).text();
$("#results").html("clicked");
$.post("/sandbox/jqueryAjaxErrorPost.php",
{
error: ""+text+""
},
function(data)
{
$("#results").html(data);
},
"html"
)
}
function errorHandler(event,jqXHR,ajaxSettings,thrownError)
{
msg="thrownError:"+thrownError+" "+"info:"+jqXHR.statusText + " "+jqXHR.responseText + ajaxSettings.url;
$("#results").html(msg);
}
function initialize()
{
$("button").click(butClick);
$("html").ajaxError(errorHandler);//
}
window.onload=initialize;
</script>
<html>
<body>
<button>Error</button>
<button>Error Trapped</button>
<button>No Error</button>
<div id="results">Results</div>
</body>
</html>
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
?>