Advertisement
drog27

code

Sep 19th, 2013
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.51 KB | None | 0 0
  1. $(document).ready(function ()
  2. {
  3. $("a").on('click',function()
  4. {
  5. console.log("asd");
  6. });
  7.  
  8. $.getJSON('modulos/get_marca.php', function(data) {
  9. $.each(data, function (index) {
  10. $('#tabla_marcas > tbody').append(''
  11. +"<tr id= "+data[index].id_marca_c+">"
  12. +"<td>"
  13. +"<span id='id_"+data[index].id_marca_c+"'>"+data[index].id_marca_c +"</span>"
  14. +"<input type='text' id='input_id_"+data[index].id_marca_c+"'value="+data[index].id_marca_c+" style='display:none; width:80%;'/>"
  15. +"</td>"
  16. +"<td>"
  17. +"<span id='nombre_c_"+data[index].id_marca_c+"'>"+data[index].nombre_c +"</span>"
  18. +"<input type='text' id='input_nombre_c_"+data[index].id_marca_c+"'value="+data[index].nombre_c+" style='display:none; width:80%;'/>"
  19. +"</td>"
  20. +"<td>"
  21. +"<span id='lugar_c_"+data[index].id_marca_c+"'>"+data[index].lugar_c +"</span>"
  22. +"<input type='text' id='input_lugar_c_"+data[index].id_marca_c+"'value="+data[index].lugar_c+" style='display:none; width:80%;'/>"
  23. +"</td>"
  24. +"<td>"
  25. +"<span id='fecha_c_"+data[index].id_marca_c+"'>"+data[index].fecha_c +"</span>"
  26. +"<input type='text' id='input_fecha_c_"+data[index].id_marca_c+"'value="+data[index].fecha_c+" style='display:none; width:80%;'/>"
  27. +"</td>"
  28. +"<td>"
  29. +"<span id='distancia_c_"+data[index].id_marca_c+"'>"+data[index].distancia_c +"</span>"
  30. +"<input type='text' id='input_distancia_c_"+data[index].id_marca_c+"'value="+data[index].distancia_c+" style='display:none; width:80%;'/>"
  31. +"</td>"
  32. +"<td>"
  33. +"<span id='tiempo_c_"+data[index].id_marca_c+"'>"+data[index].tiempo_c +"</span>"
  34. +"<input type='text' id='input_tiempo_c_"+data[index].id_marca_c+"'value="+data[index].tiempo_c+" style='display:none; width:80%;'/>"
  35. +"</td>"
  36. +'<td>'
  37. +"<a href='#'><i class='icon-pencil'></i></a> "
  38. +"<a href='#myModal' role='button' data-toggle='modal'><i class='icon-remove' ></i></a>"
  39. +'</td>'
  40. +'</tr>');
  41. });
  42.  
  43. });
  44.  
  45. $('#myModal').modal('hide');
  46.  
  47.  
  48. $( "#btn_delete_user" ).click(function() {
  49. $.ajax({ // ajax call starts
  50. type: 'POST',
  51. url: 'modulos/delete_marca.php', // JQuery loads php
  52. data: {"id" : id}, // Send value
  53. contentType: "application/x-www-form-urlencoded",
  54. dataType: "html",
  55. async: true,
  56. success: function(datos) // Variable data contains the data we get from serverside
  57. {
  58. $('#myModal').modal('hide');
  59. if(datos==1)
  60. {
  61. $("#estado").removeClass("alert alert-error");
  62. $("#estado").addClass("alert alert-success");
  63. $("#estado").html("El registro ha sido eliminado!.");
  64.  
  65. $("#"+id).remove();
  66. $.pnotify({
  67. delay: '300',
  68. title: 'Hecho!',
  69. text: 'El registro ha sido eliminado.',
  70. type: 'success'
  71. });
  72. }
  73.  
  74.  
  75. }
  76.  
  77. }); //ajax
  78.  
  79. }); // $( "#btn_delete_user" ).click(function()
  80.  
  81.  
  82.  
  83.  
  84.  
  85. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement