javascript - Pulling in specific elements with Ajax -


i building wordpress site. using ajax pull in content page fill empty div when particular element clicked. each element has different url made url variable. need ajax pull in particular element url. instead keep pulling in entire page. i've tried using various methods select specific element, i've hit wall , need little help.

    (function($) {            function find_page_number( element ) {              return parseint( element.html() );          }            $('.member-info').on('click', function (event) {              event.preventdefault();                page = find_page_number( $(this).clone() );                var membersrc = $(this).attr('href');                $.ajax({                    url: membersrc,                  type: 'get',                  datatype:'html',                  data: {                      action: 'ajax_pagination',                      query_vars: ajaxpagination.query_vars,                      page: page                  },                  success: function( html ) {                      $("#main").empty();                      $('#main').append( html);                  }                });            })      })(jquery);

you can filter answer jquery:

$('#main').append( $(html).find('#main').html() ); 

Comments

Popular posts from this blog

swift - Button on Table View Cell connected to local function -

dns - Dokku server hosts two sites with TLD's, both domains are landing on only one app -

c# - ajax - How to receive data both html and json from server? -