jquery,javascript常用

1.jquery ajax应用

ajax方式

$.ajax({ url: 'stat.php',

type: 'POST',

data:{Name:"keyun"},

dataType: 'html',

timeout: 1000,

error: function(){alert('Error loading PHP document');},

success: function(result){alert(result);}

});

post 方式

jQuery.post( url, [data], [callback], [type] ) :使用POST方式来进行异步请求

参数:

url (String) : 发送请求的URL地址.

data (Map) : (可选) 要发送给服务器的数据,以 Key/value 的键值对形式表示。

callback (Function) : (可选) 载入成功时回调函数(只有当Response的返回状态是success才是调用该方法)。

type (String) : (可选)官方的说明是:Type of data to be sent。其实应该为客户端请求的类型(JSON,XML,等等)

例:

$.post("Ajax.aspx", { Action: "post", Name: "lulu" },     
   function (data, textStatus){        
    // data 可以是 xmlDoc, jsonObj, html, text, 等等.  
    //this;
    // 这个Ajax请求的选项配置信息,请参考jQuery.get()说到的this  
   alert(data.result);        }, "json");

2.jquery 常用标签

//attr输出属性的值,属性名还可以自定义
//att 参数如果是class, 输出就是class的值RemoveLink    $(".RemoveLink").attr("class");
var recordid = $(".RemoveLink").attr("data-id");
 <a href="#" class="RemoveLink" data-id="@item.RecordId">Remove</a>


// 访问table中td的值
$('#item').text()


3.jquery 特效

 //$(selector).fadeOut(speed,callback) 淡出效果 speed:•毫秒 (比如 1500)•"slow"•"normal"•"fast"; 默认normal
                    $('#row' ).fadeOut('slow');
原文地址:https://www.cnblogs.com/userbibi/p/4383429.html