Guest User

Untitled

a guest
Jun 21st, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. <script type="text/javascript">
  2.  
  3.  
  4.  
  5. $(function() {
  6. $( "#fecha" ).datepicker({
  7. changeMonth: true,
  8. changeYear: true,
  9. yearRange: '1950:2010'
  10. });
  11. });
  12.  
  13.  
  14.  
  15.  
  16.  
  17. function list_load(){
  18. $('#contactos').load('user-list.php',
  19. function(data){$(this).slideDown('fast');}
  20. );
  21.  
  22. }
  23. function validateForm()
  24. {
  25. //$("#prod_name_error").empty().hide();
  26. //$("#prod_quantity_error").empty().hide();
  27.  
  28. var nombre = $("#nombre").val();
  29. var apellido = $("#apellido").val();
  30.  
  31. var errors = 0;
  32.  
  33. if (nombre == null || nombre == '')
  34. {
  35. $("#error").show().append("Contact Name is required");
  36. errors++;
  37. }
  38. if (apellido == null || apellido == '')
  39. {
  40. $("#error").show().append("Lastname is required");
  41. errors++;
  42. }
  43.  
  44.  
  45. if (errors > 0)
  46. {
  47. alert ("Errors were found on the form");
  48. return false;
  49. }
  50.  
  51. }
  52. jQuery(document).ready(function(){
  53.  
  54.  
  55.  
  56.  
  57. $('#form_user').hide();
  58. $('#editar').hide();
  59. $('#eliminar').hide();
  60. $('#agregar').click(function(event) {
  61. event.preventDefault();
  62. $('#form_user').show();
  63. });
  64.  
  65. $('#user_form_add').bind('click',function (){
  66.  
  67. $.post("user-add.php", $('#form_user').serialize() ,
  68. function (data){
  69.  
  70.  
  71. list_load();
  72.  
  73.  
  74.  
  75. }
  76. );
  77. });
  78.  
  79. $('#contactos').load('user-list.php',
  80. function(data){
  81. $(this).slideDown('fast');
  82. //$("#user_list_table").tablesorter();
  83. }
  84. );
  85.  
  86. $('#form_user').ajaxForm({
  87. target: '#content',
  88. beforeSubmit: validateForm
  89. });
  90.  
  91.  
  92.  
  93. });
  94.  
  95. </script>
Add Comment
Please, Sign In to add comment