tiny carousel not working with ajax

tiny carousel not working with ajax

I am trying to make this to work by loading other data from external file.
Unfortunately, the buttons and the carousel don't slide, only when loading data from ajax.
How can I get this to work?

Notice: the buttons and numbers don't work.

Here is the ajax:
  1.     $("#city").change(function(){
  2.         var city=$("#city").val();
  3.         $.ajax({
  4.             type:"post",
  5.             url:"../../data/image.php",
  6.             data:"city="+city,
  7.             success:function(data){
  8.                 $("#slider1").html(data);
  9.             }
  10.         });
  11.     });
And here is how I get the data: (image.php file)
  1. $city=$_POST["city"];

  2. $result=mysql_query("SELECT * FROM images WHERE city='$city' ");

  3. echo '<a href="#" class="buttons prev link">left</a>
  4. <script>
  5. // Popup window code
  6. function newPopup(url) {
  7.  popupWindow = window.open(
  8.    url,"popUpWindow","height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes");
  9. }
  10. </script><div class="viewport">
  11. <ul class="overview">';

  12. while($fetch = mysql_fetch_array($result))
  13. {
  14. echo '<a href="javascript:newPopup(\'sample.php\');" class = "link"><li><img src="../../upload/image/'.$fetch['image'].'" width="400" height="200"></li></a>';
  15. }
  16. echo '</ul>
  17. </div>
  18. <a href="#" class="buttons next link">right</a>
  19. <ul class="pager">
  20. <li><a rel="0" class="pagenum link" href="#">1</a></li>
  21. <li><a rel="1" class="pagenum link" href="#">2</a></li>
  22. <li><a rel="2" class="pagenum link" href="#">3</a></li>
  23. <li><a rel="3" class="pagenum link" href="#">4</a></li>
  24. </ul>';
This file is incorporated inside another file. Ajax makes it possible that the data is sent to #slider1 div to the other file. When copy pasting this code to the other file, it works perfectly.