AlenV
491
2
Vue

Execute php script with axios

Posted 10 months ago by AlenV

Is there a way to execute php script with axios? This is what I am trying and it gives me back all the code back in response instead of executing.

    axios.get('http://localhost:8080/script.php', {
                headers: {
                    'Content-Type': 'application/x-www-form-urlencoded',
                    'Allow-Control-Allow-Origin': '*'
                },
                params: {
                    'id': 1
                }
            })
            .then((response) => (
                console.log(response)
            ))
            .catch((error) => (
                console.log(error)
            ))

Please sign in or create an account to participate in this conversation.