如何在jquery中连接 [英] How to concatenate in jquery

查看:67
本文介绍了如何在jquery中连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



新的Jquery请帮助我这个



代码:



Hi All

Am new in Jquery pls help me to this

Code :

var AddData;
                    $.each(GetStudent, function (i, item) {
                        AddData = [{ Category: "Category", StudentCode: item.StudentCode, StudentAddress: item.StudentAddress, StudentGrade: item.StudentGrade, StudentName: item.StudentName, EmployeesCount: 65 }];
                        debugger;
                    });





here



here

GetStudent

将从数据库中返回两行,我希望在

will return two rows from the database i want stored that rows with in

AddData

中存储该行,在此代码中仅返回最后一条记录,i想要退回所有数据,怎么做



谢谢



我试过的:



从昨天开始在谷歌尝试

, in this code return last record only , i want to return all data , how to do that

Thanks

What I have tried:

tried in google from yesterday

推荐答案

.each(GetStudent,function( i,item){
AddData = [{Category:Category,StudentCode:item.StudentCode,StudentAddress:item.StudentAddress,StudentGrade:item.StudentGrade,StudentName:item.Studen tName,EmployeesCount:65}];
调试器;
});
.each(GetStudent, function (i, item) { AddData = [{ Category: "Category", StudentCode: item.StudentCode, StudentAddress: item.StudentAddress, StudentGrade: item.StudentGrade, StudentName: item.StudentName, EmployeesCount: 65 }]; debugger; });





这里



here

GetStudent

将返回两行我希望数据库存储在

will return two rows from the database i want stored that rows with in

AddData

中的行,在此代码中仅返回最后一条记录,我想返回所有数据,该怎么做



谢谢



我的尝试:



从昨天开始在谷歌试用

, in this code return last record only , i want to return all data , how to do that

Thanks

What I have tried:

tried in google from yesterday


试试这个

try this
var AddData = [];


.each(GetStudent,function(i,item){
AddData.push({Category:Category,StudentCode:item.StudentCode,StudentAddress:item.StudentAddress,StudentGrade:item.StudentGrade,StudentName: item.StudentName,EmployeesCount:65});
});
.each(GetStudent, function (i, item) { AddData.push({ Category: "Category", StudentCode: item.StudentCode, StudentAddress: item.StudentAddress, StudentGrade: item.StudentGrade, StudentName: item.StudentName, EmployeesCount: 65 }); });





使用 JavaScript Array push()方法 [ ^ ]将数据附加到数组中。



use JavaScript Array push() Method[^] to append the data in an array.


这篇关于如何在jquery中连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆