帝王谷资源网 Design By www.wdxyy.com
jquery把数组变为字符串然后在传到服务端(jquery把数组转换成字符串后,格式如1,2,3,速度,rewr) 复制代码 代码如下:
define(function(require, exports, module) {
var Notify = require('common/bootstrap-notify');
module.exports = function($element) {
$element.on('click', '[data-role=batch-delete]', function() {
var $btn = $(this);
name = $btn.data('name');
var ids = [];
$element.find('[data-role=batch-item]:checked').each(function(){
ids.push(this.value);
});
if (ids.length == 0) {
Notify.danger('未选中任何' + name);
return ;
}
if (!confirm('这的要删除选中的' + ids.length + '条' + name + '吗?')) {
return ;
}
$element.find('.btn').addClass('disabled');
Notify.info('正在删除' + name + ',请稍等。', 60);
var values=ids.toString();
$.post($btn.data('url'), {ids:values}, function(){
window.location.reload();
});
});
};
});
接收jquery传过来的字符串,并解析成数组,再把数组转换成list集合
复制代码 代码如下:
/**
* 批量删除私信。
*/
@RequestMapping(value = "/delete", method = {RequestMethod.GET,RequestMethod.POST})
public ResponseEntity<AjaxPostResponse> delete(HttpServletRequest request) {
// 待删除的私信ID列表
String messageIds = ServletRequestUtils.getStringParameter(request, "ids", "");
String[] messageList=messageIds.toString().split(",");
List<String> messageIdList = Arrays.asList(messageList);//数组转换成list
logger.info("------------"+messageIds);
logger.info("------------"+messageList[0]);
try {
boolean opStatus = messageManager.delete(messageIdList);
logger.info("删除私信:opStatus={}", opStatus);
return this.okResponse(opStatus);
} catch (Exception e) {
logger.error("添加私信时发生异常, Cause: ", e);
return this.errorResponse(e.getMessage());
}
}
define(function(require, exports, module) {
var Notify = require('common/bootstrap-notify');
module.exports = function($element) {
$element.on('click', '[data-role=batch-delete]', function() {
var $btn = $(this);
name = $btn.data('name');
var ids = [];
$element.find('[data-role=batch-item]:checked').each(function(){
ids.push(this.value);
});
if (ids.length == 0) {
Notify.danger('未选中任何' + name);
return ;
}
if (!confirm('这的要删除选中的' + ids.length + '条' + name + '吗?')) {
return ;
}
$element.find('.btn').addClass('disabled');
Notify.info('正在删除' + name + ',请稍等。', 60);
var values=ids.toString();
$.post($btn.data('url'), {ids:values}, function(){
window.location.reload();
});
});
};
});
接收jquery传过来的字符串,并解析成数组,再把数组转换成list集合
复制代码 代码如下:
/**
* 批量删除私信。
*/
@RequestMapping(value = "/delete", method = {RequestMethod.GET,RequestMethod.POST})
public ResponseEntity<AjaxPostResponse> delete(HttpServletRequest request) {
// 待删除的私信ID列表
String messageIds = ServletRequestUtils.getStringParameter(request, "ids", "");
String[] messageList=messageIds.toString().split(",");
List<String> messageIdList = Arrays.asList(messageList);//数组转换成list
logger.info("------------"+messageIds);
logger.info("------------"+messageList[0]);
try {
boolean opStatus = messageManager.delete(messageIdList);
logger.info("删除私信:opStatus={}", opStatus);
return this.okResponse(opStatus);
} catch (Exception e) {
logger.error("添加私信时发生异常, Cause: ", e);
return this.errorResponse(e.getMessage());
}
}
标签:
jquery,数组变字符串
帝王谷资源网 Design By www.wdxyy.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
帝王谷资源网 Design By www.wdxyy.com
暂无评论...
更新日志
2024年10月28日
2024年10月28日
- 群星2013-青春缤纷辑压箱宝大公开3CD2[新加坡限量版][WAV整轨]
- 林育群.2013-BalladShow(日本版)【环球】【WAV+CUE】
- 陈加洛.1992-痛到感觉不到【宝丽金】【WAV+CUE】
- 群星.2023-宿命之敌电视剧原声带【韶愔音乐】【FLAC分轨】
- 東京事変-大発見[FLAC+CUE]
- 椎名林檎-三文ゴシップ[FLAC+CUE]
- 2024年08月04日
- 裘德《裘德「最后的水族馆」演唱会LIVE》[320K/MP3][228.89MB]
- 裘德《裘德「最后的水族馆」演唱会LIVE》[24bit 48kHz][FLAC/分轨][2.08G]
- 基因三重奏《如果你什么都不说 音乐会现场录音》[320K/MP3][145.37MB]
- 孟庭苇.1996-月亮说话(2020环球24KGOLD限量版)【上华】【WAV+CUE】
- 群星.1997-新艺宝优质音响系列·国语精选监听版【新艺宝】【WAV+CUE】
- 阿桑.2005-寂寞在唱歌(星外星引进版)【华研国际】【WAV+CUE】
- 基因三重奏《如果你什么都不说 音乐会现场录音》[FLAC/分轨][287.43MB]
- 蔡题谦《我爱你,却依然要看你走》[320K/MP3][88.65MB]