我正在尝试向后端发送一些参数。
var params = $('#creationModal').serialize();
console.log(params);
$.ajax({
type: 'post',
url: '/create-flow/save?flowName=' + flowName + '&testCaseNames=' + testCaseNames + '&' + params
console.log(params):params = 506%2C77& params = sfa& params = sfasgags
问题是我得到一个包含506,77,sfa,sfasgags
的字符串,但第一个值506,77
实际上是一个浮点数。
我只想发送由|
而不是,
分隔的字符串。有没有办法以这种方式序列化?
后端
@RequestMapping(value = "/create-flow/save" , method = RequestMethod.POST)
public @ResponseBody String saveFlow(HttpSession session, @RequestParam("flowName") String flowName, @RequestParam("testCaseNames") String[] testCaseNames, @RequestParam(value = "params", required = false) String params) {
String user = session.getAttribute("loggedUser").toString();
return TestFlow.addFlow(flowName,testCaseNames, params,user);
}