ajax 的两种方式

来源:互联网 发布:同花顺mac版离线 编辑:程序博客网 时间:2024/06/11 14:13

1、

$('input').blur(function(){

     $.ajax({
  type: "GET",
  url: "/10.php",
  data: "1=a&2=b",
  success: function(msg){
//alert( "Data Saved: " + msg );
  }
});

})

2、

 $('input').blur(function(){

        //类型、URL、数据
        $.get('25.php?u='+this.value , function(msg){
           // alert(msg);
               if(msg == '1') {
                  $('#reg').html('<font color="red">已被注册</font>');
              } else {
                 $('#reg').html('<font color="green">可用</font>');
             }
        });
    });


0 0
原创粉丝点击