I'm giving a load () on my div, but it always disables jquery commands as soon as it loads! Any solution ???
$(document).ready(function () {
$('#form_campo').on('submit', function() {
$.ajax({
url: 'matriz/salvacad.php',
type: 'post',
data: $('#form_campo').serialize(),
success: function(data) {
$('.erase').click();
$(".menu").load(location.href + " .menu > *");
}
});
return false;
});
The jquery function in another file is
$('.cat').click(function (e) {
e.preventDefault();
$('.categoria').fadeToggle("fast");
$('.menu').fadeOut('slow');
});
$(".close_red").click(function(e){
e.preventDefault();
$(".categoria").fadeOut('fast');
});
But only works before reload, or giving a refresh on the page
<div class="menu" id="menu">
<div class="menux cat">Categoria</div><br>
<div class="separated"></div>
<?php
mysql_set_charset('utf8');
$mostra = mysql_query("SELECT * FROM categoria" )or die (mysql_error());
$ver = mysql_fetch_array($mostra);
$status = $ver["categoria"];
if (empty($status)){
echo('');
}
else{
echo('<div class="menux camp" style="margin-top: 10px; ">Campos do Produto</div><br>
<div class="separated"></div> ');
}
?>
<div class="menux prod" style="margin-top: 10px; ">Produtos</div><br>
</div>