Skip to main content

Posts

Showing posts from July, 2016

Using Node.js and Websockets in Cakephp 3.x

  Using Node.js and Websockets in Cakephp 3.x Node.js is a platform built on Chrome’s JavaScript runtime to make building applications in JavaScript that run on the server .Node.js is the latest technology that used for create realtime applications and with cakephp we can use to send updated data to each connected clients. The main advantage of node.js is that you don't need to refresh a webpage or create ajax requestto update users data. Websockets And Node.js is the great combination to update data from server side to client side. so here is the tutorial for how to use node.js and websockets in cakephp 3.x. 1. First we need to install node.js on server. you can follow this tutorial to How to Install Node.js .  2. Then you need to install Socket.io on your server.to install socket.io on your server you nedd to run this command. sudo apt-get npm install socket.io 3. After installation of Socket.io we are ready to use node.js and websockets with cakephp ....

clear ajax requests from browser console

How to clear ajax requests from browser console  Yes we can clear ajax requests from mozilla firefox console tab .to clear ajax requests from console we use javascript function function clearconsole() {   console.log(window.console);   if(window.console || window.console.firebug) {    console.clear();   } } when you call this function after your ajax request then all ajax request from console will be hide . call this function after ajax success , done or fail . Example             $.ajax({                         type:"POST",                          url: form.attr('action'),             ...

How to do PHP unserialize jQuery serialized form data

How to do PHP unserialize jQuery serialized form data   The Jquery serialize method just takes the form elements and puts them in string form. example - "firstvariable=value&secondvariable=othervalue"; if you are not using associative array then you can access this variable by $_GET and $_POST method. Example =  $variable1 = $_GET[' firstvariable '];  but if your data in an array then you need to unserialize jquery serialized data in php. you can unserialize jquery seralized data by usin this methods. you can unserialize jquery serialize data into php by using parse_str. //GET METHOD $params = array (); parse_str ( $_GET , $params );   //POST METHOD $params = array (); parse_str ( $_POST , $params );   if your data serialize data in a variable then you need to use-    $params = array(); parse_str($_POST['formdata'], $params);     you can also use this function to unserialize your data   functi...