0
$('.getLocation').on("click", function(){

            $.getJSON("searchJson.php",{address:address},function(json){
                if(json!=null){ 
                    var str = ""; 
                    $.each(json,function(index,array){ 
                        str =  '<div class="getLocation2"><ul>'; 
                        str += ...;
                        str += '</ul></div>';

                    }); 
                }
                }
            });

    });
    $('.getLocation2').click(function(){
        //do something...
        loadIframe(address);
    });

});
function loadIframe(url) {//do something...}

Before click the getLoction class,the getLocation2 function is working well.

But after click the getLoction class,the getLocation2 function is not working.

So I confuse that if the jquery click function not working after Ajax ?

this is my website: http://www.marc.url.tw/trusonus/tw/page/findstore/store.php

the getLocation class is in the dropdown list ,after click I wish to load the google map and refresh the data from db throught the ajax. After loading the data from ajax,the getLocation function is not working anymore.

user3003727
  • 579
  • 1
  • 5
  • 7
  • 2
    After ajax update you need to bind the event – sree Jun 07 '14 at 01:29
  • I add a section code to bind the function again,and it works! thanks~ – user3003727 Jun 07 '14 at 01:47
  • $(document).on("click", '.getLocation2', function(event) { var address = $(this).find('li.StoreBodyLeft_Shop_add').html(); loadIframe(address); }); I add a section code to bind the function again,and it works! – user3003727 Jun 07 '14 at 01:50

0 Answers0