javascript, jQuery convert PHP string to number

May 9, 2014

Working with PHP data inside javascript. Echo or passing a php number in javascript may turn it to be string instead of integer. example:

PHP get latitude and longitude using google maps API

April 15, 2014

Example: Output longitude and latitude which can be very useful for location services. Detailed variable setting see below reference:

jquery get the parent element’s id

February 17, 2014

You could use event delegation on the parent div. Or use the closest method to find the parent of the button. The easiest of the two is probably the closest.

JSON value not showing in HTML by PHP

December 16, 2013

There are few possibility why JSON data not being displayed properly. To debug your data, use If print_r shows empty or nothing, use Output: string ‘{"en":"Home","fr":"Office","cn":"bar"}’ (length=1 Possibility 1) – json data being encoded to html code. Some CMS will encoded the json data output. To solve this html entity issue, decode the data like […]

Processing PHP array with json jquery $.each() get key value

December 11, 2013

A simple start will be, example array Output: “1″ Another example given array: Output: “136438349186fwjbr is test3″ etc….