0

Greetings

I've got this code that tries to update a sortable list (not really a list since I don't use ordered lists, but divs). The thing is, I tested in another area of my site and it's working fine. When moving forward to another list, it just doesn't seem to work at all...

This is the code that is working

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.js"></script>

<script>
$(document).ready(
function() {
$("#cont_etiquetas").sortable({
	update : function () {
	serial = $('#cont_etiquetas').sortable('serialize');
	$.ajax({
	url: "../includes/updateList.php?mod=noticias",
	type: "post",
	data: serial,
	error: function(){
	alert("theres an error with AJAX");
}
});
}
});
}
);

This is a working example of my HTML/PHP code

<div id="cont_etiquetas">

		<?php 
		
		
		$sentence = "SELECT * FROM $table ORDER BY sort ";
		$query = mysql_query($sentence);
		if(!$query)
		{
			echo "Erro ao executar a query".mysql_error();
		}
		while ($row = mysql_fetch_array($query)){
		
		$titulo=$row['titulo_noticia'];
		$id=$row['ID'];
		$descricao = $row['corpo_noticia'];
		$data_adic = $row['data'];
		
		
		echo'<div class="etiquetas" id="menu_'.$id.'">';
		
		
				echo '<div class="tit_etiq">';
					echo $titulo;
				echo'</div>';
		
		echo'<div class="botoes_comando">
					
					<a href="#"><div class="visualiza" id="visualiza"></div></a>
					<a href="#" onClick="show3()"><div class="edita"></div></a>
					<a href="../crud/delete.php?id='.$id.'&mod='.$table.'" onclick="return show_confirm()"><div class="elimina" id="delete"></div></a>
					<a href="#" onClick="show()"><div class="upimagem"></div></a>
				</div>';
				
				
			echo '</div>';

And here are the non-working examples

jQuery

<script>
$(document).ready(
function() {
$("#container_submenu").sortable({
	update : function () {
	serial = $('#container_submenu').sortable('serialize');
	$.ajax({
	url: "../includes/updateList.php",
	type: "post",
	data: serial,
	error: function(){
	alert("theres an error with AJAX");
}
});
}
});
});
</script>
$sentence = "SELECT menu.ID, menu.titulo, menu.id_modulo FROM menu, modulos WHERE menu.id_modulo = modulos.id_modulo AND modulos.nome_mod='Servicos' ORDER BY sort";

		
		$query = mysql_query($sentence);
		if(!$query)
		{
			echo "Erro ao executar a query".mysql_error();
		}
		echo '<div id ="container_submenu">';
		while ($row = mysql_fetch_array($query)){
		
		$id_sub = $row['ID'];
		$titulo_menu = $row['titulo'];
		
			
		if(isset($_GET['id_menu']))
		{
			if($_GET['id_menu']==$id_sub)
			{
				echo '<div class="etiquetas_subm_active" id="menu_'.$id_sub.'">';
			}
			else
			{
				echo'<div class="etiquetas_subm" id="menu_'.$id_sub.'">';
			}
		}
		else echo'<div class="etiquetas_subm" id="menu_'.$id_sub.'">';
		echo '<div class="tit_etiq_subm">';
				
				echo '<a href="back_servicos.php?id_menu='.$id_sub.'">';
				echo '<div class="subm_records">';
				echo $titulo_menu;
				echo '</div>';
				echo '</a>';
				echo '<br>';

		echo'</div>';
		echo'<div class="botoes_comando_subm">
			
			<a href="view.php?id='.$id_sub.'"><div class="edita"></div></a>
			<a href="../crud/delete.php?id='.$id_sub.'&mod=menu" onclick="return show_confirm()"><div class="elimina" id="delete"></div></a>
			<a href="../upload/upload_crop.php?id='.$id_sub.'&mod=menu"><div class="up_imagem"></div></a>
		</div>';
		echo'</div>';
		
		}
	
		
	
	
	echo'</div></div>';

Thanks in advance for any possible help

Edited by fantasma: n/a

1
Contributor
1
Reply
2
Views
5 Years
Discussion Span
Last Post by fantasma
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.