jquery积累
来源:互联网 发布:淘宝评论打不开 编辑:程序博客网 时间:2024/05/01 21:03
重置表单内容
$('#menu_menuForm').resetForm();
获得Object的两种方法
$("input[name='departTypeVO.name']").val(departType_depTypeSelect['name']);
$("input[name='departTypeVO.name']").val(departType_depTypeSelect.name);
//防止名称保留字
Ajax弹出确认窗
varflag=confirm("确定要删除"+menu_menuNodeSelect.name+"吗?");
if(flag==true){}
else{}
each遍历ObjectArray
1.object
$.each(data,function(key,value){
alert(“key= ”+key +”;value=”+value);
});
2.array
$.each(data,function(i,item){
alert(“index= ”+i +”;item_object= ”+ item);
});
Ajax的数据提交方式
1.通过data传值 (当dataType为dataType:"json"时 返回的是String 当dataTypr为dataType:"json"时 返回的是JsonObject)
$.ajax({
type:"get",
dataType:"json",
cache:false,
data:{"name1":data1 ,
"name2":data2},
url:"${pageContext.request.contextPath}/common/user_getUserByDepart.action",
success:function(data){
//清空表格数据
user_userTable.fnClearTable();
//添加用户数据
if (objectNotNull(data))
addTableRow(user_userTable, data);
}
});
2.通过(?&) 传值
$.ajax({
type:"get",
dataType:"json",
cache:false, url:"${pageContext.request.contextPath}/common/user_getUserByDepart.action?name1="+data1+"name2="+data2,
success:function(data){
//清空表格数据
user_userTable.fnClearTable();
//添加用户数据
if (objectNotNull(data))
addTableRow(user_userTable, data);
}
});
2.Ajax相应点击事件提交(含有error的检测)
$(".logout-button").click(function(event)
{
// stop the contact form from submitting normally
event.preventDefault();
$.ajax(
{
url: "/?ACT=79&return=%2F",
type: "post",
dataType: "html",
data: $(this).serialize(),
// there was an error
error: function(jqXHR, textStatus, errorThrown)
{
displayAjaxMessage("Sorry, there was an error logging out, please try again.");
},
success: function(html, textStatus, jqXHR)
{
$("#login-form").show();
$(".logout-button").hide();
displayAjaxMessage("<p>You are now logged out</p>");
}
});
});
- jquery积累
- jQuery积累
- JQuery点滴积累
- Jquery 的积累
- Jquery 操作积累
- jquery easyui 知识积累
- JQuery函数积累
- JQuery知识点积累
- jQuery知识积累
- jQuery效果积累
- jquery的积累
- jQuery-学习积累-1
- jQuery-学习积累-2
- jQuery-学习积累-3
- jQuery-学习积累-4
- jQuery学习积累
- jquery使用积累
- Jquery解决“动画积累”问题
- 调查称过半新加坡年轻女性上传照片前会先修图
- 合并两列为一列
- 静电释放的危险
- 实验五: 树和二叉树实验
- linux shell编程 数组
- jquery积累
- Eclipse快捷键
- 在bat脚本中区分操作系统版本
- 为什么ListView的顶部和底部没有分隔线
- Failed to load JavaHL Library.
- spring中实现自己的定时器
- C# Dev PropertyGrid
- 加速计+ 陀螺仪+磁场
- C#的构造函数