ajax_1
方式一
$.ajax({
type: 'POST',
url : '/show-choose-edit',
data: JSON.stringify(map),
async : true,
timeout : 15000,
contentType : "application/json; charset=utf-8",
dataType: 'json',
success: function (data) {
},
error: function(e){
}
})
方式二
$.ajax({
url : '/setDivinerConfig',
type : "POST",
contentType : "application/json; charset=utf-8",
dataType : "json",
async : true,
timeout : 180000,
data : JSON.stringify(logTpl),
error: function(XMLHttpRequest, textStatus, errorThrown) {
}
}).done(function(data, textStatus, jqXHR) {
if (data.status == 'ok') {
}else if(data.status == 'nopermission'){
} else {
}
});
setTimeout
setTimeout(function(){ window.location.href='/edit-diviner-config/' + p_conf['placementId']; },6000)
使用JS数组
var arr = new Array();
arr.push();
for(var index in arr){
alert(arr[index]);
}
触发器trigger
('#btnSave').trigger("click");
按钮disable
.addClass('disabled');
.removeClass('disable');
相同.class的each遍历
$("#inputId" ).keyup(function(){
var val = $(this).val();
$('.edit-pid-class' ).each(function(){
if($(this).html( ) == val){
var a = "#myTab a[href='#di-placement-"+val+"']";
$(a).trigger("click");
}
if($(this).html().indexOf(val) == 0){
$(this ).show();
}else{
$(this ).hide();
}
});
});
center():让提示信息显示在中间
jQuery.fn.center = function () {
this.css('position','absolute');
this.css('top', ( $(window).height() - this.height() ) / 2 + $(window).scrollTop() + 'px');
this.css('left', ( $(window).width() - this.width() ) / 2 + $(window).scrollLeft() + 'px');
return this;
}
按钮disable