Skip to main content


Showing posts from August, 2017

Simple CRUD Example in Cakephp

Simple CRUD Operation in CakePHP 2.x This tutorial will explain about CRUD Operation in CakePHP. Here we will perform mysql Insert, Select, Update, Delete operation in cakePHP Framework. As we know CakePHP uses MVC design patterns. Here we will cover following points: 1. MySQL Database Table Used 2. We are using CakePHP Version 2.x 3. Create/Select/Update/Delete records. We have assume that you have already created you database table. Here is simple users table structure. CREATE TABLE `users` (   `id` bigint(20) UNSIGNED NOT NULL primary key AUTO_INCREMENT,   `firstname` varchar(128) NOT NULL,   `lastname` varchar(128) DEFAULT NULL,   `username` varchar(128) DEFAULT NULL,   `password` varchar(128) DEFAULT NULL,   `email` varchar(128) DEFAULT NULL,   `created` datetime DEFAULT NULL,   `modified` datetime DEFAULT NULL, ) Create action inside Users controller. Controller: app/Controller/UsersController.php Create add function inside controller: add() function is

How to use Ajax in WORDPRESS

How AJAX Works In WordPress What's AJAX? AJAX stands for Asynchronous JavaScript And XML . It is the use of the XMLHttpRequest object to communicate with servers, which means it can communicate with the server, exchange data, and update the page without having to refresh the page. Step1: Define the Ajax URL. var ajaxurl = '<?php echo admin_url( 'admin-ajax.php' );?>'; Step2: Define its action and perform with using POST method var emailAddress = jQuery('#uemail').val(); var searchData = { action: 'get_registered_email', email_address:emailAddress, } Step 3: Perform ajax request jQuery.ajax({ url: ajaxurl, type: "POST", data: searchData, success: function(data){   jQuery("div#divLoading").removeClass('show');   jQuery('#memberResult').html(data);   //alert(data); }, error: function(errorThrown){ alert(errorThrown); } }); Step 4: Use Wordpress 2 ajax hooks