Select2 and CodeIgniter 4: A Guide to Loading Data with jQuery AJAX

The functionality of common HTML select elements is improved by the Select2 jQuery plugin. You can quickly look up and choose multiple items from a dropdown list using Select2.

It allows loading data using jQuery AJAX.

This tutorial focuses on integrating the Select2 plugin with CodeIgniter 4 and using jQuery AJAX to load data from a MySQL database. To ensure secure communication, the tutorial also covers how to pass the CSRF token with the AJAX request.

If you’re unfamiliar with enabling CSRF protection, then you can view this tutorial which provides a helpful resource to guide you through the process.

Select2 and CodeIgniter 4: A Guide to Loading Data with jQuery AJAX

 

Read more

Autocomplete textbox with Vue.js PHP and MySQL

By adding autocomplete to a textbox makes it easier to search for an item. It displays a suggestion list based on the input in the textbox.

I am using the Axios package for loading suggestions.

In this tutorial, I show how you can add autocomplete textbox using a custom component in Vue.js. I am using PHP to fetch data from the MySQL database and return a response for suggestions.

Autocomplete textbox with Vue.js PHP and MySQL

Read more

How to Send AJAX request with CSRF token in CodeIgniter 4

Cross-Site Request Forgery (CSRF) requests are a type of malicious exploit whereby unauthorized commands are performed on behalf of an authenticated user.

CodeIgniter 4 provides protection from CSRF attacks. But it is not enabled by default same as CodeIgniter 3.

The token is generated for each user and it is managed by CodeIgniter to verify the user request.

In this tutorial, I show how you can enable CSRF protection and send AJAX request with CSRF token in the CodeIgniter 4 project.

How to Send AJAX request with CSRF token in CodeIgniter 4

Read more

How to upload multiple files with JavaScript and PHP

Are you tire­d of wasting time uploading files one by one­? The struggle is real! Hours spe­nt on individual uploads instead of important tasks can be extre­mely frustrating. But don’t worry – there’s a solution for you. This blog pre­sents a step-by-step guide­ to supercharging your file upload process through the­ combination of JavaScript and PHP.

Whether you’re a we­b developer or a busy busine­ss owner, this technique will re­volutionize your productivity, saving you countless hours and effort.

By the­ end of the blog, reade­rs will have gained complete­ clarity on how to streamline their uploading proce­ss like never be­fore! Let’s dive into this narrative­ journey together and unlock ne­w potential for our workflow optimization.

How to upload multiple files with JavaScript and PHP

Read more