jquery,javascript常用

來源:互聯網
上載者:User

標籤:

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‘);

 

jquery,javascript常用

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.