javascript中如何以对象方式向后台传参

javascript中如何以对象方式向后台传参,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。

以对象方式向后台传参

	@ApiOperation(value = "更新Onsiteptw1yfcs详细信息", notes = "根据url的id来指定更新对象,并根据传过来的Onsiteptw1yfcs信息来更新Onsiteptw1yfcs详细信息")
	@ApiImplicitParams({ 
			@ApiImplicitParam(name = "listpojo", value = "更新的对象", required = true, dataType = "List<Onsiteptw1yfcs>"),
			@ApiImplicitParam(name = "setfield", value = "跟新listpojo中对象的那些字段对应的类字段不是表字段 不填默认更新所有字段 列如: item1,item2,item3", required = false, dataType = "String"),
			@ApiImplicitParam(name = "mapfilter", value = "更新条件,在数据写好条件放上就好了 以集合形式接收 例如:{”column1=“:“2”,”column2 like “:”%li%“ } ", required = true, dataType = "Onsiteptw1yfcs")})
	
	@PutMapping("/v1/onsiteptw1yfcs/moreupdate")
	public Response updateBatchOnsiteptw1yfcs(@RequestBody Onsiteptw1yfcsParam param) {
		...
	}
var listpojo = {};
listpojo["mapfilter"] = {};
listpojo["setfield"] = "infoname,infocnt";//infoname =  '吊车:RTFK-120' , infocnt =  '是'
listpojo["listpojo"] = fields1;
listpojo1 = JSON.stringify(listpojo);console.debug('478::listpojo1>>>'+listpojo1);

$.ajax({
	url: url1,
	data:listpojo1,
	type: "put",
	dataType: "json",
	headers: {
		Authorization: authtoken
	},
	contentType:"application/json",
	success: function (result) {
		console.debug('success:'+JSON.stringify(result));
		mui.toast("OK"); 
	},
	error:function(e){
		console.debug('error:'+JSON.stringify(e));
	}
});	

关于javascript中如何以对象方式向后台传参问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注行业资讯频道了解更多相关知识。