Welcome Guest, Not a member yet? Register   Sign In
Codeigniter + Infinity scroll help

(12-14-2018, 06:16 PM)dave friend Wrote:
(12-14-2018, 04:36 PM)HarrysR Wrote: So to sum up, two major questions:
1) Is it possible for this to be achieved with just a single controller (e.g.: index.php) or should i create a second one (something like "get_data.php")?
Since i kinda made it by using ajax and "GET" method, with an extra controller and i load the new data using "load->view->('new_data', $data) etc.. etc..) in that controller. 

2) And this is only to clarify it in my head, is it safe to load those new data using ".html(data)" function?

My first reaction is to think in terms of one controller using several methods. For instance, an "index" method would load the initial "page" and some other method - let's call it "filter" - is the target URL in the dropdown change .ajax call. A hypothetical "scroll" method would handle the infinite-scrolling workload by way of a separate ajax call.

It would be equally valid to use two controllers - one for the initial page load and another that responds to ajax requests.

Is it "safe" to use  ".html(data)"? Without any knowledge of what you are outputting and where it came from I cannot answer. The use of ".html(data)" isn't inherently dangerous on its own.  (Actually, your likely going to want to use ".append(data)" instead of ".html".) Either way, the danger lies in data that came from "the outside" and could be attempting an exploit of some kind. But the danger isn't any different from loading a view page.

Thank you very much! I will take a look at what you suggested!

//Life motto
if (sad() == true) {

Messages In This Thread
Codeigniter + Infinity scroll help - by HarrysR - 12-11-2018, 03:15 PM
RE: Codeigniter + Infinity scroll help - by HarrysR - 12-14-2018, 06:43 PM

Theme © iAndrew 2016 - Forum software by © MyBB