0
votes

i try one axios post with multiple variable. But i can't. Register.vue post username, firstname and lastname. One item succesfully send because tree item can not sent. I sent data from "register.vue" to "routes.php". I am searching this but cannot find. peoples just say about "register.vue",nobody dont say anything about routes.php.

 register.vue:
             axios.post(`http://localhost:8000/register`,
                params:{
                  un=this.un,
                  fn=this.fn,
                  ln=this.ln
                })
                .then(function(response){
                  console.log("data------");
                  console.log(response.data);
                  console.log("data-------");
                });                                                                                                     


routes.php:  

Route::post('register',function(Request $un,Request $fn,Request $ln)
  {
    $redis=Redis::connection();
    $un=$un->input();
    $fn=$fn->input();
    $ln=$ln->input();
    reset($un,$fn,$ln);
    $tobe=$redis->exists("$un:$fn:$ln");
    return $tobe;
  });
1
Can you show your code - Rwd
please see How to Ask and minimal reproducible example to get you started - Alex Tartan
thank you for your interest. I update. - ComNurz

1 Answers

0
votes

1) Remove the params object, it should be just object 2) You are declaring variables in wrong way, it should be like this - un:this.un

axios.post(`http://localhost:8000/register`, {
                    un: this.un,
                    fn: this.fn,
                    ln: this.ln
                }).then(function (response) {
                    console.log(response.data);
                });