Filter strings with jQuery/Javascript -
im trying use $.get load pages without reloading page.
<script> $('#top_links a').click(function (e) { e.preventdefault(); var link = $(this).attr('href'); $('#content').empty(); $.get(link, { }, function(data) { $('#content').empty().append(data); } ) }); </script>
this works entire requested page getting stuffed #content
. instead of detecting ajax request , filtering data on server-side, client-side. there way use javascript filter string divs? content want preserve contained inside of div called #content
( im trying swap current page's #content
requested page's #content
).
try load
method loading of page fragments approach:
$("#content").load(link + " #content > *");
here can use > *
in order include inner html of #content
block without surrounding <div id="content"></div>
(check more information here).
Comments
Post a Comment