我是 Axios 請求,因為使用會導致 414 錯誤。這是對象:postgetrows= { 0 : { "name":"Thor", "status":"active", "email":"[email protected]", }, 1 : { "name":"Mesa", "status":"active", "email":"[email protected]", }, 2 : { "name":"Jesper", "status":"stdby", "email":"[email protected], },}這只是對象格式的一個示例。在實際的一個中有400多個元素,因此而不是。我在正確構建表單數據時遇到了麻煩。以下是我所擁有的:postgetlet data = new FormData();Object.keys(rows).forEach(key => data.append(key, rows[key])); // <--- this doesn't dodata.set('target', target); // <---- this comes through just fineaxios({ method: 'post', url: 'byGrabthorsHammer.php', data: data, headers: {'Content-Type': 'multipart/form-data'}}).then(function(response) { if (response.error) { console.log('failed to send list to target'); console.log(response); } else { console.log('response: '); console.log(response); } });通過的只是var_dump($_POST);'。這不是我想要的。我怎么能正確地重寫這個,以便我得到數據到另一邊(如GET...)。[Object][Object]' when i
JS:具有大型嵌套對象和表單數據的 axios POST
aluckdog
2022-08-27 13:54:20