Skip to main content

Posts

Showing posts from July, 2015

jQuery Populate City Country Dropdown in Cakephp

Populating city Dropdown based on Country Selecting by using jQuery and Ajax. Step 1: Load the jquery library <script type="text/javascript" src="http://code.jquery.com/jquery.js"></script> Html view: <div> <label>Country:</label> <select class="country"> <option>Select</option> <option value="usa">United States</option> <option value="india">India</option> <option value="uk">United Kingdom</option> </select> </div> <div id="response">     <!--Response will be inserted here--> </div> Step 2: Call jQuery change event and fetch the ajax <script type="text/javascript"> $(document).ready(function(){     $("select.country").change(function(){         var selectedCountry = $(".country option:selected").val();         $.ajax({          ...

PHP Magic Function

PHP Magic Function The " magic " methods are ones with special names, starting with two underscores, which denote methods which will be triggered in response to particular PHP events. magic functions will never directly be called by the programmer – actually, PHP will call the function ‘behind the scenes’. List of List of Magic Methods in PHP __construct:  This magic methods is called when someone create object of your class. Usually this is used for creating constructor in php5. __destruct:  This magic method is called when object of your class is unset. This is just opposite of __construct. __get:  This method called when your object attempt to read property or variable of the class which is inaccessible or unavailable. __set:  This method called when object of your class attempts to set value of the property which is really inaccessible or unavailable in your class. __isset:   This magic methods trigger when isset() function is applied on any p...