动态获取表单的name属性以及value值,拼接成json格式

news/2024/7/10 23:41:34 标签: json, jquery
		//根据form表单的id属性获取
		var t = $('#upddNewFieldform [name]').serializeArray();
	 	var  param = {};
	 	//组成json
		for(var i = 0; i < t.length; i++){
			if(t[i].value!=""&&t[i].value!=null){
				var names=t[i].name;
				var value=t[i].value;
				param[names]=value;
			}
		}
		//自定义设置
		param["index"]=tabidx;
		param["id"]=$("#virusId").val();

http://www.niftyadmin.cn/n/1522464.html

相关文章

前端获取当前域名,url等信息

1&#xff0c;设置或获取对象指定的文件名或路径: window.location.pathname 2&#xff0c;设置或获取整个 URL 为字符串: window.location.href 3&#xff0c;设置或获取与 URL 关联的端口号码: window.location.port 4&#xff0c;设置或获取 URL 的协议部分: window.loca…

监听文件夹,如果有新文件添加,则将该文件直接上传服务器

我的监听是在启动类添加 MapperScan ServletComponentScan ComponentScan SpringBootApplication public class AbcApplication { public static void main(String[] args) { SpringApplication.run(AbcApplication.class, args); ListeneFolder listennew ListeneFolder(); //…

重置form表单所有内容

$(’#form表单id’)[0].reset();

循环删除List集合中的实体类元素

一、首先基本的for循环,但也是最容易出错的地方 for(int i0;i<list.size();i){ if(list.get(i).getName().equals(“aaa”)){ list.remove(i); } } remove()方法删除元素后会立刻更新List的size&#xff0c;因此index也发生了变化&#xff0c;会导致漏掉某些元素。解决办法1…

mysql 导入大SQL文件 如何设置

因为mysql在默认清空下,当你执行SQL文件的时候,事务时自动提交的,也就是说insert一次就要执行提交一次,这样会导致导入速度很慢,所以在导入SQL大文件时,设置一下mysql将自动提交关闭,就能大大缩减时间1、可以从黑窗口进入mysql mysql -u root -p 2、输入数据库密码 3、可以创建…

判断在select下拉框中是否存在某个指定值的option元素

aaa是select的的id 第一种: var res $(’#aaa’).find(“option[value”动物"]"); if (res.length > 0) { alert(有) }else{ alert(没有) } 第二种: var opts document.getElementById(‘aaa’).options; for(var i0, nopts.length; i<n; i){ if(opts[i].val…

本地maven运行命令 安装已下载好的jar 到本地

打开本地cmd窗口 aaa bbb 1.1.3 mvn install:install-file -Dfilee:/ccc.jar(jar包的位置) -DgroupIdaaa(上面的groupId) -DartifactIdbbb(上面的artifactId) -Dversion1.1.3(上面的version) -Dpackagingjar

图片转换png格式

srcpath: e:bbb.tif (图片路径) targetPath: e:aaa.png(转换后的图片路径) try { this.tif2Jpg(srcpath, targetPath); } catch (IOException e1) { e1.printStackTrace(); System.out.println(“tif转换jpg失败&#xff01;”); } public void tif2Jpg(String srcFile, Strin…