Advertisement
freddy0512

js get fullpath

Nov 3rd, 2015
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $('.edit_button').on("click", function(e) {
  2. var id = $(this).data('id');  
  3.  $.ajax({
  4. url: base_url + "product/edit/"+id,
  5. type: "GET",
  6. dataType: "JSON",
  7. success: function(data)
  8. {
  9.            
  10.  var foto= data.foto;
  11.  var src= base_url + "uploads/product";
  12.  
  13. // alert(src); //this get full path jake but
  14. //when i write like in bellow with comments, i get url  src/defaultgambar.png/ after insepect element !
  15. //what should i write in js to get full folder jake ?
  16.  
  17. if (foto==null) {
  18.  //$('#images-from-db-here-put-here').html("<img src='src/defaultgambar.png'>");
  19. $('#images-from-db-here-put-here').html("<img src='http://localhost/cilihat/uploads/default/defaultgambar.png' width='150px' height='150px'>");
  20. }
  21. else
  22. {
  23. //$('#images-from-db-here-put-here').html("<img src='src/"+data.foto+"'>");
  24.   $('#images-from-db-here-put-here').html("<img src='http://localhost/cilihat/uploads/product/"+data.foto+"' width='150px' height='150px'>");
  25.  }
  26.  
  27. },
  28.        
  29.  });
  30.       });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement