Posts

Showing posts from June, 2015

convert Json data to Php Array

How To convert Json data to Php Array json_decode ( ) - Decode JSON Formatted Data The json_decode() PHP function converts JSON data to PHP array data. Parameters data The json data that you want to decode in PHP. dataTypeBoolean Optional boolean that makes the function return a PHP Associative Array if set to "true", or return a PHP stdClass object if you omit this parameter or set it to "false". Both data types can be accessed like an array and use array based PHP loops for parsing. depth Optional recursion limit. Use an integer as the value for this parameter. options Optional JSON_BIGINT_AS_STRING parameter. A very simple example: <?php $jsonData = '{ "user":"John", "age":22, "country":"United States" }'; $phpArray = json_decode($jsonData); print_r($phpArray); foreach ($phpArray as $key => $value) {     echo "<p>$key | $value</p>"; } ...

How To Convert JSON Data Into Html Table Using Javascript jQuery

Image
In this tutorial i am going to explain about how to display the json data into html table using javascript & jquery. For explaining how we convert the json data into html table using javascript & jquery we have created a json file that contains the below json data. Json File [ {"Model" : "Iphone 18", "Name" : "iOS", "Share" : 57.56,"Price Range":"$800 - $1000","Brand":"Apple"},  {"Model" : "Nexus 23", "Name" : "Android", "Share" : 24.66,"Price Range":"$600 - $800","Brand":"Samsung"},  {"Model" : "Tom-tom", "Name" : "Java ME", "Share" : 10.72,"Price Range":"$200 - $900","Brand":"X Brand"}, {"Model" : "Nokia 66610", "Name" : "Symbian", ...

add-remove-input-fields-dynamically-with-jquery

Image
                       If you are looking to add and remove duplicate input fields, here’s jQuery example below to do the task for you. This jQuery snippet adds duplicate input fields dynamically. JQUERY FILE $ ( document ) . ready ( function ( )   {       var   max_fields       =   10 ;   //maximum input boxes allowed       var   wrapper           =   $ ( ".input_fields_wrap" ) ;   //Fields wrapper       var   add_button       =   $ ( ".add_field_button" ) ;   //Add button ID           var   x   =   1 ;   //initlal text box count       $ ( add_button ) . click ( function ( e ) {   //on add input button click       ...