Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. jQuery(function() {
  2. jQuery('.searcher-rooms .button').click(function() {
  3. var n = jQuery.now(),
  4. l = jQuery('.town-list').val(),
  5. c = jQuery('.short-hotel-list').val();
  6. if (l == null) {
  7. l = 'all';
  8. };
  9. if (c == null) {
  10. c = 'all-hotels';
  11. };
  12. if (l != '' && l != 'all' && l != 'current') {
  13. n += '&l='+l;
  14. };
  15. if (c != '' && c != 'all-hotels') {
  16. n += '&c='+c;
  17. };
  18. jQuery.ajax({
  19. url: theme.child_theme_uri+'/searcher.php?t='+n,
  20. type: 'GET',
  21. beforeSend: function() {
  22. jQuery('#data-wrapper').addClass('loading');
  23. }
  24. }).done(function(data) {
  25. jQuery('#data-wrapper').html(data).attr('data-time', n.toString().split('&')[0]).attr('data-location', l).attr('data-hotel', c);
  26. jQuery('#data-wrapper').removeClass('loading');
  27. jQuery('.load-more-hotels').bind('click', d_more_hotels);
  28. })
  29. })
  30. });
  31.  
  32. function d_more_hotels() {
  33. var e = jQuery('#data-wrapper'),
  34. t = e.attr('data-time'),
  35. l = e.attr('data-location'),
  36. c = e.attr('data-hotel'),
  37. w = jQuery('.load-more-hotels').attr('data-page');
  38. jQuery.ajax({
  39. url: theme.child_theme_uri+'/searcher.php?t='+t+'&l='+l+'&c='+c+'&w='+w,
  40. type: 'GET',
  41. beforeSend: function() {
  42. jQuery('#data-wrapper').addClass('loading');
  43. }
  44. }).done(function(data) {
  45. jQuery('#data-wrapper').html(data)
  46. jQuery('#data-wrapper').removeClass('loading');
  47. jQuery('.load-more-hotels').attr('data-page', parseInt(w)+1).unbind().bind('click', d_more_hotels);
  48. })
  49. }
  50.  
  51. url: theme.child_theme_uri+'/searcher.php',
  52. type: 'GET',
  53. data: {"t":t, "l":l, "c":c, "w":w} ,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement