我正在尝试使用axios将表单数据发送到php脚本。axios的语法正确吗?如何查看通过post方式发送的数据? 我刚开始用vuetify和php编程,所以我需要一点帮助。 methods: {
formSubmit(e) {
e.preventDefault();
let currentObj = this;
this.axios.post('http://localhost/index.php/',{
name : this
route.js
const parser = multer({ storage: storage });
app.post('/api/images', parser.single("MyImage"), function(req, res){
console.log(req) // to see what is returned to you
const image = {};
image.url = req.file.url;
image.id = req.file.public_id;
res.send({data:image})
当我试图发送带有axios的post请求时,在控制台中面临此错误
Access to XMLHttpRequest at 'localhost:8080' from origin 'http://localhost:3000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
axios.post('localhost:808
我正在使用nextjs,并且我试图使用带有“钩子”的"functional“来使用"axios”来获取数据,但是我得到了以下错误:"AxiosError: Request failed with status code 404",这是我的代码。
import { useState, useEffect } from "react";
import { useParams } from "react-router-dom";
import axios from "axios";
const Post = () =&
我的routes.rb
resources :post do
resources :answers do
resources :anscomments
end
end
模型
post.rb
has_many :answers
answer.rb
belongs_to :post
has_many :anscomments
anscomment.rb
belongs_to :answer
控制器
answers_controller.rb
class AnswersController < ApplicationController
de
因此,我一直在我的React JS组件中放置以下代码,我基本上是试图将这两个API调用放在一个名为vehicles的状态中,但我收到了以下代码的错误: componentWillMount() {
// Make a request for vehicle data
axios.all([
axios.get('/api/seat/models'),
axios.get('/api/volkswagen/models')
])
.then(axios.spread(function (seat, vo