$(document).ready(function(){//这个就是jQueryready ，它就像C语言的main 所有操作包含在它里面 
$("#after").change(function(){ 
login(); //点击ID为"button_login"的按钮后触发函数 login(); 
}); 
$("#front").change(function(){
login(); //点击ID为"button_login"的按钮后触发函数 login(); 
}); 
$("#type").change(function(){
type(); //点击ID为"button_login"的按钮后触发函数 login(); 
});

}); 
function login(){ //函数 login(); 

var front = $("#front").val();//取框中的密码 
var after = $("#after").val();
$('#level').val( $("#front>option:selected").get(0).text + '-' + $("#after>option:selected").get(0).text);

$.ajax({ //一个Ajax过程 
type: "post", //以post方式与后台沟通 
url : "level.php", //与此php页面沟通 
dataType:'json',//从php返回的值以 JSON方式 解释 
data: 'front='+front+'&after='+after, //发给php的数据有两项，分别是上面传来的u和p 
success: function(json){//如果调用php成功 
//alert(json.username+'\n'+json.password); //把php中的返回值（json.username）给 alert出来 
$('#amount').val( json.ccc );
$('#price').html( json.ccc );
$('#time').html( json.bbb );
$('#need').val( json.bbb );
} 
}); 
} 
function type(){

$('#server').val( $("#type>option:selected").get(0).text );
}