1
我需要將表單發佈請求發送給期望值爲map(int,int)的API的格式?或者我應該序列化它?通過發佈請求預期的地圖(int,int)
我需要將表單發佈請求發送給期望值爲map(int,int)的API的格式?或者我應該序列化它?通過發佈請求預期的地圖(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)上的值來轉換它們。