Hello guys,
I really, really,really need some help with my school project, I’m using framework 7 version 2, so far so good, am able to post data with ajax smoothly. The big problem am facing is fetching my data from database and display it on my html page using template7.
here is how am trying to fetch data from database on router.js
{
path: '/universities/',
async: function (routeTo, routeFrom, resolve, reject) {
var router = this;
// App instance
var app = router.app;
app.request({
url: 'http://localhost/assaa-backend/fetch.php',
dataType: 'json',
method: "GET",
crossDomain: true,
success: function (response) {
$$('.articles').html(response),
console.log(response),
resolve(
{
componentUrl: './pages/universities.html',
},
{
context: {
list: response,
},
}
);
}
});
}
},
I use console.log(response) and I can see the data perfectly. But I don’t have a clue how to pass those data to template7.
Here is my json output:
{"list":[{"id":"1","uni_name":"Galgotias University","uni_country":"India","uni_city":"New Delhi","uni_budget":"2000 USD","uni_courses":"Technology, Pharmacy, Mechanical Engineering, Civil","uni_intakes":"January, March"},{"id":"2","uni_name":"Amity University","uni_country":"India","uni_city":"New Delhi","uni_budget":"1500 USD","uni_courses":"Technology, Chemical Engineering, Medical, Pharmacy","uni_intakes":"January, August"},{"id":"3","uni_name":"Centurion University","uni_country":"India","uni_city":"Odisha","uni_budget":"1500 USD","uni_courses":"Engineering & Technology, Applied Sciences, Agriculture, Management, Humanities and Social Sciences","uni_intakes":"January"}]}
Please if anyone solved something like this please share the code or ideas.
Thank you