Advertisement
zSkullfox

Untitled

Nov 2nd, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. $( document ).ready(function() {
  2.  
  3.  
  4. /* DONT TOUCH IT !!!! ONLY AJAX STUFF
  5. var arg = new Object();
  6. arg.folder = folder;
  7.  
  8. callApi('fnc as php function',Arg as Object);
  9. */
  10. window.callApi = function(fnc, arg){
  11.  
  12. $.ajax({
  13. type: "POST",
  14. url: "./core/handler.php?call=" + fnc,
  15. async: true,
  16. dataType: 'json',
  17. data: arg,
  18. success: function(data,status,xhr) {
  19.  
  20. ajaxReHandler(data)
  21.  
  22. }
  23.  
  24. })
  25.  
  26. };
  27.  
  28. function ajaxReHandler(data){
  29.  
  30. console.group('AjaxReHandler')
  31.  
  32. console.log('Execute: ' + data[0] + '()');
  33. var fnc = data[0];
  34. data.shift(),
  35.  
  36.  
  37. console.warn( data );
  38. console.groupEnd()
  39.  
  40.  
  41.  
  42. fncStr = eval(fnc);
  43.  
  44. fncStr(data);
  45.  
  46.  
  47. };
  48.  
  49.  
  50. })
  51.  
  52. //Outside jQuery
  53.  
  54. function demo(data){
  55.  
  56. console.error(data);
  57.  
  58. }
  59.  
  60.  
  61.  
  62. function sleep(millis, callback) {
  63. setTimeout(function()
  64. { callback(); }
  65. , millis);
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement