[SOLVED] jQuery toggle not working for ajax loaded content

Some days ago while doing code for my client, I faced an issue with toggle function of jquery, and realized a fact about this function which I never knew earlier that jquery toggle function does not work for ajax loaded content.

I tried to make it work by using it in different ways but it did not work then after researching on google I came to know that toggle function will not work for content who is added dynamically in body tag. So, I had to find out the alternate of toggle function to get my work done. My code using toggle function was as which was working for content which was not shown through ajax : Keep on reading

addThis share not working for ajax loaded sharing icons

addThis is a robust solution for sharing content to different social platforms. It has plugins also which can be used for this purpose. addThis provides the html or we say toolbox which shows the social icons when we implement that to any page or post. We can also provide the url, title media or description of the page or post within the toolbox which are to be shared through social media icons.

Sometimes, we need to show this toolbox with sharing content through ajax. I we simply show the toolbox html through ajax, then the sharing icon will not display or will not work. To show and to make them work, we will have to reinitialize the toolbox in just single line which is : Keep on reading

Get current map in event handler of marker click or position changed

Sometimes, we need to used map to get its current zoom level or center coordinates in event handlers. We can easily use map variable which we have created to show map through google map javascript api, but problem occurs when there are multiple map presents on the page, then in event handler we cannot use just map variable, to identify that  the event handler is fired for which map, so we need to use extra function to get map in event handler of google map javascript api.

Google Map API has a function get(‘map’) which can be used to get current map. I have shown here two examples below which shows how to use this function : Keep on reading

Create multiple custom controls dynamically in Google Map API

If we want to create google map javascript api’s custom control then we can find the solution in developer guide of google map api but if we want to create custom control dynamically by sending its html and position in PHP then, we did not find its solution easily. I have created the custom control dynamically using javascript and PHP, so I am posting my content here, so anyone can get help. My code is here :

//Define custom control html and position here
//Here I am creating more than one custom control
$custom_control_html = array(
0 => array(‘html’=>’Control 1’, ‘position’=>’TOP_LEFT’),
1=> array(‘html’=>’Control 2’, ‘position’=>’TOP_CENTER’)
?> Keep on reading

Geocoding & Reverse Geocoding in Google Map Javascript API

Geocoding is a technique of Google Map API which is used to get complete information about an address like its geographic coordinates (latitude, longitude), its city, state, postal_code, country etc. In javascript, we can just simply use below code to get geographic coordinates of any location :

<script type=”text/javascript”>
var geocoder_obj = new google.maps.Geocoder(); Keep on reading

Javascript Google Map API : Change the content of infowindow using AJAX

Its an interesting subject that how one can change the content of google map’s infowindow dynamically. Many times we need to perform an action which results in change of content of infowindow also.

For example, if we have displayed a like button for a particular place which is showing in the content, and its marker is also showing in map. On clicking on that marker, infowindow will launch. Infowindow will also have the same like button. If user clicks on like button of place which is showing in content then we may need to change the style or text of infowindow’s like button also, whenever infowindow will be launched, to show that it is liked now. Keep on reading