post 请求期望的 Map(int,int)
Map(int,int) expected by post request
我需要什么格式才能将表单 post 请求发送到 API 并期望值是 map(int,int)?还是我应该连载它?
首先,Javascript 具有弱类型检查。
其次,您的值将是 String
或 Number
(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)。
我猜你发送的是一个字符串(如果它在引号中)。如果您需要整数,请尝试对值使用 parseInt(theValue)
(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt) 来转换它们。
我需要什么格式才能将表单 post 请求发送到 API 并期望值是 map(int,int)?还是我应该连载它?
首先,Javascript 具有弱类型检查。
其次,您的值将是 String
或 Number
(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)。
我猜你发送的是一个字符串(如果它在引号中)。如果您需要整数,请尝试对值使用 parseInt(theValue)
(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt) 来转换它们。