Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. (function( $ )
  2. {
  3. $.fn.CallPhpClass = function(className, functionName, parameters, destination)
  4. {
  5. return this.each(function()
  6. {
  7. if (destination === undefined) {
  8. destination = $(this);
  9. };
  10.  
  11. $.ajax({
  12. type : 'POST',
  13. url : 'php/executer.php',
  14. data : { className : className, functionName : functionName , parameters : parameters},
  15. dataType:'text',
  16. cache: false,
  17. success : function(data) {
  18. if (className == "User" && functionName == "logout")
  19. {
  20. getMenu();
  21. return;
  22. }
  23. if (className == "User" && functionName == "login")
  24. {
  25. getMenu();
  26. return;
  27. }
  28. if (className == "User" && functionName == "lastView")
  29. {
  30. $('#main-content').CallPhpClass(data, 'view');
  31. return;
  32. }
  33. if (data.search('alert alert-error') != -1 || data.search('alert alert-success') != -1)
  34. {
  35. $('#main-content').CallPhpClass('User', 'lastView');
  36. destination = $('#error-box');
  37. }
  38.  
  39. if(destination != false)
  40. {
  41. destination.html(data);
  42. }
  43.  
  44. },
  45. error : function(data) {
  46. console.info(data);
  47. }
  48. });
  49. });
  50.  
  51. }
  52. })
  53.  
  54. if (className == "User" && functionName == "lastView")
  55. {
  56. $('#main-content').CallPhpClass(data, 'view');
  57. return;
  58. }
  59.  
  60. $.ajax({
  61. type : 'POST',
  62. url : 'php/executer.php',
  63. data : { className : className, functionName : functionName , parameters : parameters},
  64. dataType:'text',
  65. cache: false,
  66. contentType: "application/json; charset=utf-8",
  67. success : function(data) {
  68.  
  69. <script type="text/javascript" src="myscripts.js" charset="UTF-8"></script>
  70.  
  71. setlocale(LC_TIME, "es_ES.UTF8");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement