主要是測試用js代碼function getData(){ var d = document; var account = d.getElementById('account').value; console.log(account); var password = d.getElementById('password').value; axios.post('/register.php',{ firstName:'cdd', password:'123456' }) .then(function (response) { console.log(response); d.getElementsByClassName('h3')[0].innerHTML = response.data; }) .catch(function (error) { console.log(error); }); }這個是php代碼<?php
echo 'cdd的名字是:'.$_REQUEST['firstName'];?>總是出這樣的錯誤Notice: Undefined index: firstName in D:\phpStudy\WWW\register.php on line 3cdd的id是:
使用axios.js post請求總是出錯,求解!
郎朗坤
2018-08-31 09:09:23