Here, I am confronting the following problem since yesterday I try to fill my select field with the fat-free framework.
I try to use axios as in most tutorial, I point to "response.data" but nothing fills in my field.
I have this code in my model :
public function ReadUserData($action) {
if (strcmp($action, "read") == 0) {
global $f3;
$user = $this->db->exec("SELECT * FROM users");
return json_encode($user);
}
}
$Users = new UserModel($this->db);
$DataUser = $Users->ListDatabaseUser();
if (isset($_GET['action'])) {
$data = $Users->ReadUserData($_GET['action']);
$f3->set("users", $data);
}
Saisissez le c<script type="text/javascript">
var Myapp = new Vue({
el: "#app",
delimiters: ['{%', '%}'],
data: {
heading: 'test',
dataSelect: null,
makes_options: []
},
created() {
axios.get('http://localhost/?action=read')
.then(function(response) {
Myapp.make_options = response.data;
console.log(Myapp.make_options);
});
}
});
Here, I am confronting the following problem since yesterday I try to fill my select field with the fat-free framework.
I try to use axios as in most tutorial, I point to "response.data" but nothing fills in my field.
I have this code in my model :
public function ReadUserData($action) {
if (strcmp($action, "read") == 0) {
global $f3;
$user = $this->db->exec("SELECT * FROM users");
return json_encode($user);
}
}
I have this in my controller :
$Users = new UserModel($this->db);
$DataUser = $Users->ListDatabaseUser();
if (isset($_GET['action'])) {
$data = $Users->ReadUserData($_GET['action']);
$f3->set("users", $data);
}
and in vue js i have :
<script type="text/javascript">
var Myapp = new Vue({
el: "#app",
delimiters: ['{%', '%}'],
data: {
heading: 'test',
dataSelect: null,
makes_options: []
},
created() {
axios.get('http://localhost/?action=read')
.then(function(response) {
Myapp.makes_options = response.data;
console.log(Myapp.makes_options);
});
}
});
I also try to remplace :
Myapp.makes_options = "{{ @users }}" but without sucess :/
For display that i have this in html :
Saisissez le code ici...<label for="Select">Select</label>
<select class="form-control" name="dataSelect" id="dataSelect" v-model="dataSelect">
<option v-for="option in makes_options" :value="option.id">{% option.username %}</option>
</select>
Currently my field is empty and I do not understand why my json is not interpreted correctly
--
-- You've received this message because you are subscribed to the Google Groups group. To post to this group, send an email to f3-fra...@googlegroups.com. To unsubscribe from this group, send an email to f3-framework...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/f3-framework?hl=en
---
You received this message because you are subscribed to the Google Groups "Fat-Free Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to f3-framework...@googlegroups.com.
To post to this group, send email to f3-fra...@googlegroups.com.
Visit this group at https://groups.google.com/group/f3-framework.
To view this discussion on the web visit https://groups.google.com/d/msgid/f3-framework/44c7462e-9ee6-45aa-aec7-782923f11e80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.