Home  >  Article  >  Web Front-end  >  Detailed explanation of data interception issues in JavaScript

Detailed explanation of data interception issues in JavaScript

小云云
小云云Original
2018-05-22 10:45:092121browse

This article mainly shares with you the detailed explanation of data interception issues in JavaScript, hoping to help everyone.

1. Obtain from the array

1. Get the value of value


var revokeModel = $("#modalMsgRevoke form").serializeArray();
                  console.log('cxyy00:'+revokeModel[0].value)

2. Get 1 field from a set of data arrays

var formData = $("#tbMain table").DataTable().rows('.selected').data();
var arr=new Array();
for(var i=0;i

or


or when it is a string


3. Get 2 fields from a data array to form a two-dimensional array (getting multiple fields is also possible)


##①Without field

var formData = $("#tbMain table").DataTable().rows('.selected').data();
                //2.截取出  诊疗项目ID(zlxmid)  报告项目ID(bgxmid) 仪器字典编号(yqzdbh)
                var arr=new Array();//这是定义数组来存储 需要的字段
                for(var i=0;i

The output is:


②With field name

 //1. 获取table表中所有的打钩记录
                var formData = $("#tbMain table").DataTable().rows('.selected').data();
                //2.截取出  诊疗项目ID(zlxmid)  报告项目ID(bgxmid) 仪器字典编号(yqzdbh)
                var arr=new Array();//这是定义数组来存储 需要的字段
                var zlxmmc_id=Number(staData.id);//转出整数
                for(var i=0;i

The output is:


2. Data display

The above is the detailed content of Detailed explanation of data interception issues in JavaScript. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn