Categories
JavaScript PHP Programming WordPress

[JS & PHP] How to set cookies in JavaScript and get in PHP

There is the application I built today which required to send data between JavaScript and PHP. Therefore, instead of sending AJAX request everytime data has changed, I decided to set cookies from JS and use PHP to retrieve the cookies when needed.

Categories
JavaScript Programming

[JS] JavaScript Parallel Promise Tutorial

For those who haven’t heard of Promise in JavaScript before, it is a function to make JavaScript wait for something before running other operation. It is implemented in modern browsers, or just use one of those Promise polyfill.