Guest User

Untitled

a guest
Oct 10th, 2017
84
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. var request = {
  3.     'option' : 'com_ajax',
  4.     'module' : 'display_vacancies',
  5.     'format': 'json'
  6. }
  7.  
  8.  
  9. function sendRequest($request)
  10. {
  11.     jQuery.ajax({
  12.         type: 'GET',
  13.         data: request,
  14.         success:function(response){
  15.             if(response.success == false){
  16.                 console.log("Fail: " + response);
  17.             } else {
  18.                 console.log("Success: " + response);
  19.             }
  20.         },
  21.         error:function(response){
  22.             console.log("Error: " + response);
  23.            
  24.         }
  25.     });  
  26. }
  27.  
  28. jQuery(document).on('click', 'button[id=vacancies_next]', function(){
  29.  
  30.     request.method = "next";
  31.     sendRequest(request);
  32.  
  33. });
  34.  
  35. jQuery(document).on('click', 'button[id=vacancies_prev]', function(){
  36.  
  37.     request.method =  "prev";
  38.     sendRequest(request);
  39.  
  40. });
  41.  
  42. jQuery(document).on('click', 'tr[id]', function(){
  43.  
  44.     request.method = "setVacancyId";
  45.     request.vacancy_id = jQuery(this).attr('id');
  46.     sendRequest(request);
  47.    
  48. });
RAW Paste Data