$(function(){ //AJAXでダウンロード表示 $(document).on('change', '#main.download .select select, #main.download .select input', function(){ _maker = $('select#maker option:selected').val(); _products = $('select#products option:selected').val(); _solution = $('select#solution option:selected').val(); _s = $('input#s').val(); _dl = $('#tgt.select').attr('data-dw'); pn = 1; godl(_maker,_products,_solution,_s,_dl,pn); }); /**page nation**/ $(document).stop().on('click','#pagenation .pn span',function (e) { e.preventDefault(); _maker = $('select#maker option:selected').val(); _products = $('select#products option:selected').val(); _solution = $('select#solution option:selected').val(); _s = $('input#s').val(); _dl = $('#tgt.select').attr('data-dw'); pn = $(this).attr('data-page'); var target = $('#tgt'); var position = target.offset().top; $('body,html').animate({scrollTop:position}, 500, 'swing'); godl(_maker,_products,_solution,_s,_dl,pn); }); function godl(_maker,_products,_solution,_s,_dl,pn){ if(!_maker && !_products && !_solution && !_s ){ $('#main.download table#results tbody').empty(); $('#main.download div#pagenation').empty(); $('#main.download #counts').empty(); $('#main.download #counts').append('0件が見つかりました。'); return false; } $('#main.download #counts').empty(); $('#main.download #counts').append('検索中です・・・'); $.ajax({ type: 'POST', url: ajaxurl, data: { 'maker' : _maker, 'products' : _products, 'solution' : _solution, 's' : _s, 'dl': _dl, 'pn' : pn, 'action' : 'download', }, success: function( response ){ // jsonData受け取る jsonData = JSON.parse( response ); if ( response == 'false' || !jsonData[0]) { // 投稿がなかったら $('#main.download table#results tbody').empty(); $('#main.download div#pagenation').empty(); $('#main.download #counts').empty(); $('#main.download #counts').append('0件が見つかりました。'); } else { jsonData = JSON.parse( response ); $('#main.download table#results tbody').empty(); $('#main.download table#results tbody').append(jsonData[0]); $('#main.download div#pagenation').empty(); $('#main.download div#pagenation').append(jsonData[1]); $('#main.download #counts').empty(); $('#main.download #counts').append(jsonData[2] + '件が見つかりました。'); } } }); return false; } }); $(window).on('load',function(){ }); $(window).on('resize',function () { }); $(window).on('orientationchange', function(){ }); function setwp(_maker){ $('select#maker').val(_maker); var target = $('#dlinfo'); var mrg = $("#f-header").outerHeight() + 10; var position = target.offset().top - mrg; $('body,html').animate({scrollTop:position}, 500, 'swing'); _products = ''; _solution = ''; _s = $('input#s').val(); _dl = 'wp'; pn = 1; if(!_maker && !_products && !_solution && !_s ){ $('#main.download table#results tbody').empty(); $('#main.download div#pagenation').empty(); $('#main.download #counts').empty(); $('#main.download #counts').append('0件が見つかりました。'); return false; } $('#main.download #counts').empty(); $('#main.download #counts').append('検索中です・・・'); $.ajax({ type: 'POST', url: ajaxurl, data: { 'maker' : _maker, 'products' : _products, 'solution' : _solution, 's' : _s, 'dl': _dl, 'pn' : pn, 'action' : 'download', }, success: function( response ){ // jsonData受け取る jsonData = JSON.parse( response ); if ( response == 'false' || !jsonData[0]) { // 投稿がなかったら $('#main.download table#results tbody').empty(); $('#main.download div#pagenation').empty(); $('#main.download #counts').empty(); $('#main.download #counts').append('0件が見つかりました。'); } else { jsonData = JSON.parse( response ); $('#main.download table#results tbody').empty(); $('#main.download table#results tbody').append(jsonData[0]); $('#main.download div#pagenation').empty(); $('#main.download div#pagenation').append(jsonData[1]); $('#main.download #counts').empty(); $('#main.download #counts').append(jsonData[2] + '件が見つかりました。'); } } }); return false; }