Well, I'm supposing this code is a fragment of a module. If it's alone in a file the "this." won't make much sense.
this.files; // these 2 lines declarations of properties of
this.file_container; // the module. They aren't necessary once the
// properties are created on first assign,
// but it could be justa way of make code
// more clear/readable
var obj = this;
$.ajax // this is an ajax call to...
({
url: 'ajax_requests.php?link=allFile', // ... this url ...
success: function (result) //...which calls this function on success...
{
obj.construct(JSON.parse(result));
//...then, as obj = this, calls contruct method with the JSON parsed
// ajax's call result. So the ajax call returns a JSON that is
// transformed to object by the JSON.parse method. Then this object is
// used as parameter to construct method.
}
});
this.construct = function construct (files)
{
this.files = files;
// assigns previous declared files property to the result of ajax call
this.file_container = $('#file_container');
// assigns previous declared file_container property to the jscript object
// representing the DOM element whose id is 'file_container'.
this.listFiles(this.files, this.file_container);
// calls a method called listFiles (which is not present in this fragment),
//having as parameters the 2 properties files and file_container.
};
In case you don't know what AJAX is, check this: What is AJAX, really?