//When the page is initially loaded
$(document).ready (function(){
//Register a mouse click event for a button that gets a single value
$("#getMessage").click(function(){
$.getJSON("ceshi",function (data){
//The value of the message in Action can be obtained from data.message through the . operator
$("#message1").html("
" data.message "");
});
});
//Send expression data to the server
$("#getabc").click( function(){
//Serialize the form data
var params = $("form").serialize();
//Use $.ajax({}) in jQuery; Ajax method
$.ajax({
url:"ceshi",
type:"POST",
data:params,
dataType:"json",
success:function (data){
//Add the obtained data to the display layer
//Get the data of the object using data.userInfo.property
$("#message2").append("
" data.message "
")
},
error:function(){
$("#message2" ).append("
" "Incorrect information" "
")
}
});
});
});