Jquery Ajax call not loading always -


i have link when clicked pops div , collects data page through ajax call , loads data in div after success. problem this, when pop div , data loads, close div. when click link pop div again , reload data data doesn't load, doesn't sends ajax call shows me previous data loaded in div before close it. want achieve when ever div closed , link clicked again, ajax call sent php page , reloads new data link pops div <a href="javascript:;" onclick="showlikes('<?php echo $id; ?>')">likes</a>. , here ajax call:

function showlikes(x){     document.getelementbyid('#likediv').style.display='block';     $.ajax({         type: "get",         url: "/get_likes.php?id="+x,         beforesend: function(){             document.getelementbyid('#beforesendimg').style.display='block';         },         success: function(data){             document.getelementbyid('#beforesendimg').style.display='none';             likes = $(data).fadein(800);             $("#likediv").html(likes);         },     }); } 

please knows how better?

try;

function showlikes(x){     $('#likediv').css({'display:'block'}).html("");     $.ajax({         type: "get",         url: "/get_likes.php,         data: {id: x},         beforesend: function(){             $('#beforesendimg').css({'display':'block'});         },         success: function(data){             $('#beforesendimg').css({'display':'none'});             likes = $(data).fadein(800);             $("#likediv").html(likes);         },     }); } 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -