部分重新加载后链接无效

时间:2015-06-30 10:02:01

标签: jquery laravel-5

我通过局部填充视图。此时链接工作正常,因为页面已重新加载。但是,当通过ajax添加新项目时,该链接不起作用。我还在jquery点击功能中使用了on。这很奇怪,因为on通常用于这种情况。

那么,这种情况的解决方案是什么?

我正在使用 Laravel 5.0。*

1 个答案:

答案 0 :(得分:0)

尝试使用此

var contents = $('.page').find('.contents');

var nestedContents = contents.find('span:nth-child(1)');
nestedContents.attr("id", 'h3-location');

var imgContents = contents.find('span:nth-child(2)');
imgContents.attr("id", 'img-location');

$('#img-location, #h3-location').wrap('<div class="groupedContent"></div>');

或者

 $( document ).ajaxComplete(function() {
   $( ".log" ).text( "Triggered ajaxComplete handler." );
 });
相关问题