Which is the best router option to link pages whose content is requested through ajax request?
I’ll get the page content through an url like this: http://domain.com?id=10, where the id param is the content identifier. This service will return the html content the page must show.
{
path: '/aboutparams/:userName',
componentUrl: './pages/about-params.html',
name: 'about-param',
on: {
pageInit: function (e, page) {
// do something when page initialized
var id = page.route.params.userName
app.request.json('https://jsonplaceholder.typicode.com/posts/' + this.id, function (res){
console.log(res)
// your magic code
})
},
}
}
If I inspect the XHR requests I can see the one corresponding to articulo.html but in my app the page articulo.html is not shown. The page doesn’t changed.
I don’t know if this is important, but after the first click, no more request happens if I click again. I have to refresh to make the request happen.