I can load content with Ajax to my project, but the content also has Ajax calls to the same function. But these calls don't work.
$(function cargar_ajax(){
$(".call_cuerpo").on("click",function(){
var content_id = $(this).data("id")
//~ console.log(content_id)
$.ajax({
url: "/get_content?content_id="+content_id,
}).done(function(res) {
$( '.contenido_ajax' ).html(res);
});
});
});
I read that you must call the function after loading content but not how or where.
This is my div in HTML:
<div class="contenido_ajax"></div>
A working Ajax call:
<li><a href="#" class="call_cuerpo" data-id="1"><small>Load ajax content</small></a></li>
This call doesn't work if it's loaded with Ajax:
<li><a href="#" class="call_cuerpo" data-id="{{ item.content_id }}@{{ item.book_id }}">{{ item.code }}</a></li>
The code is loaded from an Ajax call.
Note: I'm using: Django 1.6 + bootstrap 3.2 + html 5
Thanks in advance.