我現(xiàn)在只知道向后臺(tái)發(fā)送數(shù)據(jù),但是不知道該如何存儲(chǔ)到指定A或者指定B,根據(jù)用戶登陸的賬戶存儲(chǔ)到該表信息$('btn').onclick = function() { var dat = ({ //json對(duì)象 'company': $('#company').value, 'Pnumber': $('#Pnumber').value, 'name': $('#name').value, 'fix_phone': $('#fix_phone').value, 'email': $('#email').value, 'qq': $('#qq').value, 'fax': $('#fax').value, 'ID': $('#ID').value, 'region': $('#region').value, }) var str = JSON.stringify(dat); var xhr = new XMLHttpRequest() || new ActiveXObject(Microsoft.XMLHttp); xhr.open('post', 'zhuceye.php'); xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xhr.send('data=' + str); //把json數(shù)據(jù)發(fā)送到php文件 xhr.onreadystatechange = function() { if(xhr.readyState == 4 && xhr.status == 200) { var res = xhr.responseText; //var aa=JSON.parse(res); console.log(res); if(res == 1) { alert('修改成功'); } } }
如何通過ajax向A賬戶的數(shù)據(jù)表存儲(chǔ)個(gè)人信息
精慕HU
2018-07-05 16:10:59