Dear friends,
I have a issue with using my bundle scripts inside a div.
I have inside my main layout some scripts one of those is:
@Scripts.Render("~/bundles/menus")
Inside the layout I have a div without html content:
<div id="ajaxResponse" ActieID="0" relatieID="0"></div>
I fill this content with a ajax post.
$("#action").click(function () {
var id = $('#ajaxResponse').attr('data');
$.ajax(
{
type: 'POST',
dataType: 'html',
url: 'Menus/action',
success: function (result) {
$('#ajaxResponse').html(result);
},
error: function (error) {
alert('Fail');
}
});
});
This post will return a partial view which will be inside the AjaxResponse div. Now I have the issue that none of the scripts able to use inside this partial view. Because I render the content of the div after layout and script bundles.
Ofcorse I can set the partialView to a normal View to solve this problem(rendering evrything) but I don't want that much content inside this div.
Does anyone know a way to render this scripts from the layout after a ajax post?
already tryed to use $(document).ready and $("action").on("click" function()) and kind of tricks. But it didn't work because the scripts not usable inside this div.
I tryed also a click event on this
Like:
$('#ajaxResponse').on("click", function()) {
}
This was working but ended up ofcorse in a double click action.
I hope someone of you guys know the right way to solve this!