ajax

ajax的几种用法

$.post(url,{password:password},functopm(data){

})

$.get(url,{password:password},functopm(data){

})

第三种

$.ajax({
  type: 'POST',
  url: url,
  data: data,
  success: success,
  dataType: dataType
});

举例

$(".submit").bind('click',function(){
var username = $("input[name='username']").val();
$.ajax({
url:"post",
type:"post",
dataType:"json",
data:"username="+username+"&password="+password,
timeout:5000,
error:function(){
alert(0)
},
success:function(){
alert(1)
}
})
 })



你可能感兴趣的:(php,ajax)