I'm designing a web application using JSF 2.2, Primefaces 4 and jQuery 2.1, with jQuery being responsible for the ajax content loading and endless scroll.
The problem I'm hitting and can't seem to overpass is when I'm loading the content for the endeless scroll using the ajax command from jQuery. This creates new session instead of using the already existing one and is obviously not acceptable as it then makes JSF lose the stored data. The remaining code uses the .load() function for the other operations and works like a charm.
Can you give me a hand at understanding why this happens?
Here's the portion of the code used for the load and appending of new content:
$.ajax({
url: link,
type: "GET",
success: function(html) {
if(html) {
var result = $('<div />').append(html).find('#center_content_data').html();
$("#center_content_data").append(result);
$('#center_content_data_loading').hide();
}
}
});
EDIT: I also tried to load the content using .post() and .get() but got the same result.
$.post(link, function(data){
$(data).find("#center_content_data").appendTo("#center_content_data");
});