I am having a couple of inconvenience, I am a new web programmer, and I'm venturing into this theme described in the title.
I'm working with a theme based on HTML + Jquery + Bootstrap and additional plugins that brings the default theme.
The situation is somewhat difficult, as I understand'm trying to implement Ajax to manage content. The problem is that not everything works well and I have some mistakes, especially when I add html content to DOM and think it might be the way or do I program my javascript.
I wish someone would see him and give me some councils.
Citing the main problems. 1. For example datepicker translate it to Spanish but I get an error (language). 2. Another problem is the re initialization of each plugins you see the content changes, this is necessary or is there a better way.
to add Content
$('[id^="p-"]').on("click", function (event, xhr, settings) {
var id = event.target.id;
$.ajax(
{type:"GET",url:"index.php",data:{idform:id},
error: function(xhr,status,error){alert(error);},
success: function(response) {$("#formarea").html(response);$("#formarea").attr('name', id);
window.ChargeJS();
CallProcces();// carga la llamada de procesos
}
});
$.ajax(
{type:"GET",url:"index.php",data:{idfield:id},
error: function(xhr,status,error){alert(error);},
success: function(data) {$("#areatitle").html(data);}
});
});
To re initilice bulk Plugins on content load
function LoadJSfile(){
/* La carga de Estos script debe ser testeada si se encuentra algun problema en los efectos del tema*/
jQuery.getScript("sources/js/plugins/metisMenu/jquery.metisMenu.js" , function(data, textStatus, jqxhr){ });
jQuery.getScript("sources/js/plugins/slimscroll/jquery.slimscroll.min.js" , function(data, textStatus, jqxhr){ });
jQuery.getScript("sources/js/plugins/flot/jquery.flot.js" , function(data, textStatus, jqxhr){ });
jQuery.getScript("sources/js/plugins/flot/jquery.flot.tooltip.min.js" , function(data, textStatus, jqxhr){ });
jQuery.getScript("sources/js/plugins/flot/jquery.flot.spline.js" , function(data, textStatus, jqxhr){ });
jQuery.getScript("sources/js/plugins/flot/jquery.flot.resize.js" , function(data, textStatus, jqxhr){ });
jQuery.getScript("sources/js/plugins/flot/jquery.flot.pie.js" , function(data, textStatus, jqxhr){ });
jQuery.getScript("sources/js/plugins/peity/jquery.peity.min.js" , function(data, textStatus, jqxhr){ });
jQuery.getScript("sources/js/inspinia.js" , function(data, textStatus, jqxhr){ });
jQuery.getScript("sources/js/plugins/pace/pace.min.js" , function(data, textStatus, jqxhr){ });
jQuery.getScript("sources/js/plugins/jquery-ui/jquery-ui.min.js" , function(data, textStatus, jqxhr){ });
jQuery.getScript("sources/js/plugins/gritter/jquery.gritter.min.js" , function(data, textStatus, jqxhr){ });
jQuery.getScript("sources/js/plugins/sparkline/jquery.sparkline.min.js" , function(data, textStatus, jqxhr){ });
jQuery.getScript("sources/js/plugins/iCheck/icheck.min.js" , function(data, textStatus, jqxhr){ });
jQuery.getScript("sources/js/plugins/chartJs/Chart.min.js" , function(data, textStatus, jqxhr){ });
jQuery.getScript("sources/js/plugins/toastr/toastr.min.js" , function(data, textStatus, jqxhr){ });
jQuery.getScript("sources/js/plugins/datapicker/bootstrap-datepicker.js" , function(data, textStatus, jqxhr){ });
jQuery.getScript("sources/js/plugins/dropzone/dropzone.js" , function(data, textStatus, jqxhr){ });
jQuery.getScript("sources/js/plugins/jeditable/jquery.jeditable.js" , function(data, textStatus, jqxhr){ });
jQuery.getScript("sources/js/plugins/dataTables/jquery.dataTables.js" , function(data, textStatus, jqxhr){ });
jQuery.getScript("sources/js/plugins/dataTables/dataTables.bootstrap.js" , function(data, textStatus, jqxhr){ });
jQuery.getScript("sources/js/plugins/dataTables/dataTables.responsive.js" , function(data, textStatus, jqxhr){ });
}
other way is one by one plugin get a function to initialice it on every instance,
An call only
ManagerGPlugin()
when load new content, need implementunbid()
or.one()
: