Jump to content

Recommended Posts

Posted

boas

Qual o problema aqui do each?

ele está-me a dar 2 resultados em vez de ser só um

$(".dd-handle").each( function(e) { console.log(e); }

o php esta assim

(...) <?php while ($img= mysql_fetch_array($imagens)){ echo '<li data-id="'.$img["ordem"].'" class="dd-item"> <div class="dd-handle" data-ordem="'.$img["ordem"].'">ordem: '.$img["ordem"].'</div> <img src="./uploads/'.$img["file"].'" width="100px" class="data-dz-thumbnail" /> <br> <div class="btn-group"> <button style="padding:2px" type="button" onClick="apagar('.$img["id_imovel_imgs"].')" class="btn btn-danger btn-block-sm"><i class="fa fa-times"></i></button> </div> </li>'; } ?>

obrigado

Posted

É uma boa pergunta. Não me parece que estejas a fornecer informação suficiente para se conseguir perceber o problema.

“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.”

-- Tony Hoare

Posted

o codigo completo dessa página está assm

<?php 
require_once("../connect.php");connect();
          $imagens= mysql_query("SELECT * FROM imovel_imgs where id_imovel=".$_GET["id"]."");
   
          $contagem= mysql_num_rows($imagens);
          if ($contagem>0){
              echo '<div class="ativo">';
          }else {
              echo '<div class="resposta">';
          }
          ?>
         <h4>Imagens Inseridas</h4><br>
              <div id="nestable" class="dd mb35">
                  <ol class="dd-list">
              <?php 
              
              while ($img= mysql_fetch_array($imagens)){
                  echo '<li data-id="'.$img["ordem"].'" class="dd-item">
                <div class="dd-handle" data-ordem="'.$img["ordem"].'">ordem: '.$img["ordem"].'</div>  
                  <img src="./uploads/'.$img["file"].'" width="100px" class="data-dz-thumbnail" />
         
<br>
<div class="btn-group">
  <button  style="padding:2px" type="button" onClick="apagar('.$img["id_imovel_imgs"].')" class="btn btn-danger btn-block-sm"><i class="fa fa-times"></i></button>
</div>

</li>';
              }
?>
                  </ol>
              </div>
          
          <?php echo '</div>'; ?>
         <script>
             $(document).ready (function (){
                 
              
                "use strict";
        // Init Theme Core
        Core.init();
                  
          var imovel="<?php echo $_GET["id"] ;?>";
       
        $('#nestable').nestable().on('change', function (){
        
        $(".dd-handle").each( function(e) {
       
        console.log(e);
       $.post('entrada.php?page=26',{ 'imovel' : imovel, 'ordem_imagem' : e 
   });
       });
   

   
      });
             
 
 });

   
        </script>

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.