PHP JavaScript deferred Loading

From HaFrWiki
Revision as of 14:15, 30 May 2018 by Hjmf (talk | contribs) (Created page with "{{TOCright}} Deferred loading is a programming technique to improve the performance of Websites by loading code only when needed. The purpose of this article is to show how to...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Deferred loading is a programming technique to improve the performance of Websites by loading code only when needed. The purpose of this article is to show how to use deferred loading of Webpage parts using PHP and JavaScript in combination with AJAX and jQuery.

Deferred loading can also be used on CSS, but that is not the scope of this article.

Introduction

When a website loads, not all content is always necessary. So why should you load such content if you don't know the use is gonna use it? In this article is assumed that the website consist on (Bootstrap) navigation tabs. The user can have several roles that gives or denies him access to certain parts of the website. If the user has the admin-role, he may access everything including the admin tab. In that case you don't want to load the admin tab at all if the user hasn't the admin-role. But also if the user has the admin-role you do need the admin tab every time you access the website.

In that case you wanna use deferred loading.

Requirements

The framework we are going to make depends on PHP-server-coding and JavaScript-Client-coding. To clue the 2 parts we are using AJAX in combination with jQuery. The application loads a form with JavaScript validation and AJAX calls for checking and CRUD operations on the Database. The form has a Bootgrid part for showing the content of the database.

Used files

FileName Description Methods
AdminDb.php Front- and Background for constants, form, Database CRUD and Database checks
  • Declares the constants

AdminDb.php



See also

top

Reference

top