Advertisement
Guest User

Untitled

a guest
Aug 21st, 2014
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. function PostsCategoriasListar(table, select, callback) {
  2. if (table) {
  3. $.ajax({
  4. url: controller_dashboard,
  5. type: 'POST',
  6. dataType: 'json',
  7. data: {acao: 'PostsCategoriasListar', Listar: 'table'},
  8. success: function(response) {
  9. if (response.status === 'LogOff') {
  10. window.setTimeout(function() {
  11. window.location.reload();
  12. }, 10000);
  13. }
  14. $element.find('table tbody').html(response.table);
  15. ExecuteDataTable(0, maximo, 1);
  16. },
  17. error: function(error) {
  18. console.log(error);
  19. }
  20. });
  21. }
  22. if (select) {
  23. $.ajax({
  24. url: controller_dashboard,
  25. type: 'POST',
  26. dataType: 'json',
  27. data: {acao: 'PostsCategoriasListar', Listar: 'select'},
  28. success: function(response) {
  29. if (response.status === 'LogOff') {
  30. window.setTimeout(function() {
  31. window.location.reload();
  32. }, 10000);
  33. }
  34. $element.find('form select').html(response.select);
  35. },
  36. error: function(error) {
  37. console.log(error);
  38. }
  39. });
  40. }
  41. //EU QUERO QUE O CALLBACK SO EXECULTE DEPOIS QUE TODO CODIGO QUE ESTIVER NOS IF'S ACIMA TENHAN TERMINADO, ELE SEMPRE EXECULTA ANTES ONDE ESTOU ERRANDO?
  42. if (typeof callback === 'function')
  43. callback();
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement