在選擇查詢條件爲空的情況下的查詢結構:
var params = "1=1";
params += name == "" ? "" : "&name=" + name;
params += queryUserName == "" ? "" : "&queryUserName=" + queryUserName;
params += template =="" ? "" : "&template=" + template;
params += asCategory == "" ? "" : "&asCategory=" + asCategory;
params += asSerial == "" ? "" : "&asSerial=" + asSerial;
params += osImage == "" ? "" : "&osImage=" + osImage;
params += status == "" ? "" : "&status=" + status;
下拉判斷被選第幾個和選擇器使用:
$("select[name='container'] option:selected").index()
ajax contentType 類型:
默認值: "application/x-www-form-urlencoded"。發送信息至服務器時內容編碼類型。
默認值適合大多數情況。如果你明確地傳遞了一個 content-type 給 $.ajax() 那麼它必定會發送給服務器(即使沒有 數據要發送)。
jquery裏面不常見用法:
$td = $("td[status]", $row); 作用是在$row對象裏面找到 td中存在status屬性的對 象,並返td對象。
$("button.stop, button.stopped")