Hi,
I retrieve some content from my server and want to render it to the Ember Main View.
Currently I add a div called disraptorView and append via jQuery the Content retrieved from the server controller.
The Problem is: once there is some content in this div it is always displayed when someone is navigating on the page.
I want to render my response to the Ember Main View but I have no idea how to properly do that.
This is my Ember Controller:
export default Ember.Controller.extend({
init: function() {
this.send('loadContent');
},
actions: {
loadContent() {
var pathArray = window.location.pathname.split('/');
var subpath = pathArray[pathArray.length-1];
var type;
type = (subpath == "") ? "main" : "sub";
Discourse.ajax({
url: `/disraptor`,
type: 'GET',
dataType: 'text',
data: {"url":subpath,"type":type}
})
.then(function(result) {
$(".disraptorView").empty();
$(".disraptorView").append($(result));
})
.catch(function(error) {
console.log(error);
});
}
}
});
Here is what it produces:
and when I move to another page on the client: