为了账号安全,请及时绑定邮箱和手机立即绑定

发布到 PHP 时出现 HttpErrorResponse - SyntaxError: JSON

发布到 PHP 时出现 HttpErrorResponse - SyntaxError: JSON

PHP
森栏 2023-07-15 10:12:28
我正在尝试将 formgoup 中的值发布到 php 页面,最终保存在 mysql 数据库中。当我尝试 POST 时,我不断收到错误响应:SyntaxError: Unexpected token a in JSON at position 41    at JSON.parse (<anonymous>)    at XMLHttpRequest.onLoad (http://localhost:8100/vendor.js:9017:51)    at ZoneDelegate.invokeTask (http://localhost:8100/polyfills.js:3505:35)    at Object.onInvokeTask (http://localhost:8100/vendor.js:75756:33)    at ZoneDelegate.invokeTask (http://localhost:8100/polyfills.js:3504:40)    at Zone.runTask (http://localhost:8100/polyfills.js:3273:51)    at ZoneTask.invokeTask [as invoke] (http://localhost:8100/polyfills.js:3586:38)    at invokeTask (http://localhost:8100/polyfills.js:4727:18)    at XMLHttpRequest.globalZoneAwareCallback (http://localhost:8100/polyfills.js:4764:25)我在离子应用程序中使用的代码是:        let body = {            fullname: this.slideOneForm.value['fullName'],            gender: this.slideOneForm.value['gender'],            age: this.slideOneForm.value['age'],            mstatus: this.slideOneForm.value['mstatus'],            flocation: this.slideOneForm.value['flocation'],            telno: this.slideOneForm.value['telno'],            email: this.slideOneForm.value['email'],            username: this.slideOneForm.value['username'],            password: this.slideOneForm.value['password'],            enterprise1: this.selected_enterprises[0],            enterprise2: this.selected_enterprises[1],            enterprise3: this.selected_enterprises[2],            farmstock1: this.slideTwoForm.value['farm_stock'][0],                };
查看完整描述

1 回答

?
达令说

TA贡献1821条经验 获得超6个赞

排序了。我的 sql 请求中存在语法错误:)



查看完整回答
反对 回复 2023-07-15
  • 1 回答
  • 0 关注
  • 87 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信