Javascript-форум (https://javascript.ru/forum/)
-   jQuery (https://javascript.ru/forum/jquery/)
-   -   Скрипт срабатывает со второго раза (https://javascript.ru/forum/jquery/69707-skript-srabatyvaet-so-vtorogo-raza.html)

misterad 14.07.2017 00:23

В общем получилось так:
<script>
$(document).on('click', '#ajaxbutton', function (e) {
  e.preventDefault();

  //alert("bottom!");

  var url3 = $('.nextt').attr('href');

  if (url3 != undefined && url3 != '') {
$('.pagination').remove();
   $('#result3').load(url3 + '&loh=1', function () {
    $('#result3 div.image').each(function(i, item) {
     $('.main-products').append('<div>' + $(item).parent().html() + '</div>');
    });
    view = $.totalStorage('display');
    if (view) {
     display(view);
    } else {
     display('grid');
    }
   });
  }
 }
);
</script>

рони 14.07.2017 00:32

misterad,
:dance: вам виднее необходимая логика


Часовой пояс GMT +3, время: 17:28.