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

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -