1
votes

I am trying to send the varaible to the url of axios but doing so it provide me the error 404 and even '{' braces are changed to '%' on error

import Axios from 'axios' export default {

mounted(){
    this.$parent.$on('create_new_lesson',(seriesId)=>{
       this.seriesId = seriesId

        $('#createLesson').modal()
    })
},
data()
{
    return{
        title:'',
        description:'',
        episode_number:'',
        video_id:'',
        seriesId:''
    }
},

methods:{
   createLesson()
   {
    Axios.post('/admin/${this.seriesId}/lessons',{
        title:this.title,
        description:this.description,
        episode_number:this.episode_number,
        video_id:this.video_id
     }).then(resp =>{
       console.log(resp)
     }). catch(resp =>{
       console.log(resp)
     })
   }
}

}

it should return send the created data to the consoleenter image description here

1
try the traditional concatenation '/admin/'+this.seriesId+'/lessons'Boussadjra Brahim
thank you for your response the below worked for meRazeev Kumar Yadav

1 Answers

3
votes

For string interpolation you need to use backticks ` instead of single quotes ':

`/admin/${this.seriesId}/lessons`