<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script src="js/jquery.min.js"></script>
<script type="text/javascript">
function requestJson() {
$.ajax({
type : 'post',
url : 'http://localhost:8080/ajaxdemo/CreateUserServlet',
dataType : 'text',
//data : '{"id":"4","usercode":"44","password":"123"}',
statusCode: {
201: function() {
alert( "created" );
}
},
complete : function( jqXHR, textStatus ) {
alert("complete");
alert(jqXHR.status); //alert 201
alert(jqXHR.responseText );
alert(textStatus);
}
});
}
</script>
</head>
<body>
<input type="button" onclick="requestJson()" value="reqeust" />
</body>
</html>
JQuery http status 201处理
最新推荐文章于 2021-11-17 11:14:43 发布