博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
浏览器中 for in 反射 对象成员 的差异
阅读量:7187 次
发布时间:2019-06-29

本文共 622 字,大约阅读时间需要 2 分钟。

http://www.cnblogs.com/_franky/archive/2010/05/08/1730437.html

下面是例子

function test(url, obj) {

if($("#myForm").size() == 0){
$("body").append("<form id='myForm'></form>");
}else{
$("#myForm").empty();
}
var data = {};
if(obj != undefined){
for(var o in obj) {
//遍历的作用,var obj = {
// '1' : 1,
// '_' : 2,
// '0' : 4,
// 'c' : 1,
//},其中o就是1,——,0,c;obj[o]是后面的1,2,4,1
if(obj[o] != null) {
var inputTag = ""
if(obj[o] != ""){
inputTag = "<input type='hidden' name="+ o +" value='"+ obj[o] +"'/>";
}else{
inputTag = "<input type='hidden' name="+ o +" />"
}
$("#myForm").append(inputTag);
}
}
data = $("#myForm").serialize();
}
}

 

你可能感兴趣的文章
window.location使用
查看>>
thinkphp框架开启页面gzip压缩
查看>>
gcc and g++分别是gnu的c & c++编译器
查看>>
centos 例行性工作转发外部邮箱
查看>>
工作中使用了一些触发器
查看>>
[每日一题] 11gOCP 1z0-052 :2013-09-7 The usage of the SQL*LOAD utility.............................
查看>>
我的友情链接
查看>>
async & await 的前世今生(Updated)
查看>>
揭开云“误”山的面纱
查看>>
Lua5.0 词法分析
查看>>
Solutions Log (2014-08)
查看>>
Java程序员从笨鸟到菜鸟之(七十八)细谈Spring(七)spring之JDBC访问数据库及配置详解...
查看>>
ElasticSearch(七)之elasticsearch集群搭建及参数详解
查看>>
Rails best practices
查看>>
Solaris 测试bonding的网卡是否可以 failover
查看>>
Ubuntu16.04 PPTP Server Setting
查看>>
你应该知道的16个Linux服务器监控命令
查看>>
Cisco Voip实验
查看>>
SonarQube集成到Eclipse中
查看>>
centos7 iptables 外网地址轮训
查看>>