jquery常用代码片断


 <html>
	<head>
		<script src="/js/jquery.js">
		</script>

		<script>

			$( document ).ready(function() { 

				$("#btn").click(function( event ) {
				    $.ajax({
				      url: "/xxx.htm",
				      type: "get",				  
				       dataType: 'json',    
				       data: "",
				      success: function(json){				          
				           $("#lbl").text(json.userNmae);
				      },
				      error:function(request, status, error){
				          alert("http code "+ status  + "\n" + error + "\n" +  request.responseText);				          
				      }   
				    }); 
				});

			});
		</script>	
	</head>
	<body>
		 

		<input type="button" id = "btn" value="Click to Show your name"/>
		 
		 <br/>

		<label id="lbl"></label>

	</body>
</html>








Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.