Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
S

serenimus

@serenimus
About
Posts
11
Topics
5
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • print array json in dinamic table <html>
    S serenimus

    Hi!! thanks for your reply..you`re right... now I changed the format of the array, and now its like this:

    0: ["Naviera Riazor"]
    1: {1: "La Coruña"}
    2: {2: "La Coruña"}
    3: ["Barcos Texeiro"]
    4: {1: "La Coruña"}
    5: {2: "La Coruña"}
    6: ["Barcos de Vela Riazor"]
    7: {1: "La Coruña"}
    8: {2: "La Coruña"}
    length: 9

    The problem is, that I dont find the way to display properly the info in the html, table,I tryed with a double loop, first for, and secon inner do...while, and two for consecutives, thats mean one inside the other..but It doesn`t work...to ne honest, sometimes I think I'm doing it very complicated, maybe there is another way to do it more simple..

    var html="";
    				var celdas=datos.length;
    				var filas=celdas/3;
    				var cont=0;
    				
    				
    				for(f=0;f";
    						html+="";
    						
    						cont++;
    						
    					}while(cont<=2);
    					
    					
    				}
    				$("#tabdat tbody").append(html);
    

    Thanks!!

    JavaScript html database mysql data-structures json

  • print array json in dinamic table <html>
    S serenimus

    Hi again!! thanks for your reply, so I put it down the proposal of a colleage from stackoverflow...there I posted the same question.. so the json array comes from the controller, filtered with json_encode();, this is the copy paste from the Chome debugger..so as you can see, I want to display the array of 9 positions in three rows one under other, and each with three cells..

    0: "Naviera Riazor"
    1: "La Coruña"
    2: "La Coruña"
    3: "Barcos Texeiro"
    4: "La Coruña"
    5: "La Coruña"
    6: "Barcos de Vela Riazor"
    7: "La Coruña"
    8: "La Coruña"
    length: 9

    this is the table, with a script, that I dont know if is "key" so that everything goes good.. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <table id="tabdat" border=1 style="margin-top: 300px;"> <thead> <tr> <th>Nombre</th> <th>Localidad</th> <th>Provincia</th> </tr> </thead> <tbody></tbody> </table> </body> and here is the function verDetalleNegocio(), that I invoke on the body with the onload method, inside I do the loop, and try to display on the #tabdat, under...

    function verDetalleNegocio(){

    			var localidad=getLocalidad();
    			var negocio=getNegocio();
    			var datos={'loc':localidad,'neg':negocio};
    			var datosS=JSON.stringify(datos);
    			
    			if(localidad!=="" && negocio!==""){
    				
    									
    				$.ajax({
    				type:"POST",
    				data:"datos="+datosS,
    				dataType:'json',
    				cache:false,
    				url:"basePath("web/negocios/detallenegocioajax")?>",
    				success:function(datos){
    				
    				
    				
    				html = "";
    				for(i=0; i";
    				 html += ""+datos\[i\]+"";
    				 html += ""+datos\[i\]+"";
    				 html += "";
    				}
    				$("#tabdat tbody").append(html);
    			   
    			   
    			  
    				
    				}
    				 
    			});
    				
    			}else{
    				return null;
    			}				
    		}
    

    and finally the result that I obtain on the screen..as you can see, the information is displayed twice...please, tell me If i can put more infomation...thanks:thumbsup: Nombre Localidad Provincia Naviera Riazor Naviera Riazor Naviera Riazor La Coruña La Coruña La Coruña La Coruña La Coruña La Coruña Barcos Texeiro Barcos Texeiro Barcos Texeiro La Coruña La Coruña La Coruña La Coruña La Coruña

    JavaScript html database mysql data-structures json

  • print array json in dinamic table <html>
    S serenimus

    Hi!! thanks a lot for your reply!! unfortunatelly, after the changes you proposed me, I get the same result :(( I`ll keep trying!! :)

    JavaScript html database mysql data-structures json

  • print array json in dinamic table <html>
    S serenimus

    Hi greeting to the comunity!! I´m trying to display the info from a array json dinamically into an html table, but I'm dont really undertand what I`m doing wrong so, I`m taking three columns from my MySql Table (Name,city and Provinz),so I need a row for each row of my sql table, if a obtain three rows , that is in total 9 cells,ordered in three rows, 3 each.. onload() on body calls the function

    function verDetalleNegocio(){

    			var localidad=getLocalidad();
    			var negocio=getNegocio();
    			var datos={'loc':localidad,'neg':negocio};
    			var datosS=JSON.stringify(datos);
    			
    			if(localidad!=="" && negocio!==""){
    				
    				$.ajax({
    				type:"POST",
    				data:"datos="+datosS,
    				dataType:'json',
    				cache:false,
    				url:"basePath("web/negocios/detallenegocioajax")?>",
    				success:function(datos){						
    					
    					var celdas=datos.length;
    					var filas=celdas/3;
    				
    					for(i=0;i");
    						$("#tabdat").append(""+datos\[i\]+"");
    						$("#tabdat").append("");						
    					}
    			
    				}
    				 
    			});
    				
    			}else{
    				return null;
    			}				
    		}
    

    here, I habe my html table:

    Nombre

    Localidad

    Provincia

    and finally, thatt the way the results are display, I would like to show the rows, one on top of the other, and not one next to the other, hoy could say in the iteration, every three, a new row!!! Thanks!!! :)

    Nombre Localidad Provincia
    Naviera Riazor La Coruña La Coruña Barcos Texeiro La Coruña La Coruña Barcos de Vela Riazor La Coruña La Coruña

    JavaScript html database mysql data-structures json

  • AJAX,how to get more values from $.ajax({}) function in a Zend Controller
    S serenimus

    Hallo to the comunity, That ist the problem, Im trying to send two values/variables fron my view (opciones.phtml), to my controller/action through an Ajax function. I get it with only one parameter, but with two I dont get it!!:mad: I`ll thank any help this is my html:

    guardar
    <span class="badge btn-success" id="resultado"></span>

    this is my javascript function, inside I invoke the ajax function.. <script type="text/javascript"> function saveNombre(){ var nombre=document.getElementById("nombre").value; var codc=<?=$this->codcli?>; if(nombre!==""){ $.ajax({ type:"POST", data:dataString, dataType:{nombre:nombre,codc:codc}, cache:false, url:"<?=$this->basePath("alta/areapersonal/updatenombreclienteajax")?>", success:function(datos){ $("#resultado").html(datos); } }); }else{ return null; } } here you find the data recepcion from view/ajax,in the controller/Action if you send only one parameter, from ajax function, you can easily "clean" the value with the PHP function trim(); but in this case, I,m try to send two values, customer code and Name, I need to include this to parameters in a function to update the name of the customer, but I dont´t konw hoe to extract from $datosCliente, some Idea?, thanks !! public function updateNombreClienteAjaxAction(){ if($this->request->isxmlHttpRequest()){ $datosCliente= $this->request->getContent("data"); }else{ var_dump("Error action Ajax"); } }

    JavaScript help php javascript html sales

  • Problems to obtain value "0" or "1" from a div
    S serenimus

    Hi!! so, I have this Ajax function vinculated to a change Jquery event:

                   $("#nif").change(function(){
    

    $.ajax({
    async:true,
    type:"POST",
    data:N,
    url:"basePath("alta/nuevouser/vernifduplicadoajax")?>",
    success:function(datos){
    $("#res").html(datos);

    				 }
    				 });
    
                                  });
    

    The matter is...that the result is or "1" (double register at DB) or "0" (no repeat), the value always appear in the div, depending of this result, I want to activate another

    and show a message an other operations.. to evaluate this value I do the next

    if($("#res").length !==0){
    var warn=parseInt(document.getElementById("res").innerHTML);
    alert(warn);
    }

    but I always receive (using alert();)..isNan ...that is, "is not a Number".. I`d need to evaluate: if(warn==1){ //do this }else{ //do that } Thanks a lot in advance!! :)

    JavaScript javascript html database question

  • unexpected result function autocomplete() Jquery
    S serenimus

    Hi!! thanks a lot for the answer... I had to go use a safe copy of the Projekt..becouse I finally didn`t find a solution :confused: Greetings!!

    JavaScript javascript php data-structures question

  • unexpected result function autocomplete() Jquery
    S serenimus

    Uppss!! I forgot to add tue links to the Jquery Library...

    ?>

    JavaScript javascript php data-structures question

  • unexpected result function autocomplete() Jquery
    S serenimus

    Hallo!! thanks a lot, for your prompt reply, so, I followed your advices, but it doesn´t work.. :sigh: $(window).on("load",function(e){ var comunidades=[ "Galicia", "Asturias", "Cantabria", "Euskadi"] $("#comu").autocomplete({ source:comunidades }); }); "If that doesn't work, then you'll need to tell us which autocomplete library you're using" ?> Thank u!!! :)</x-turndown>

    JavaScript javascript php data-structures question

  • unexpected result function autocomplete() Jquery
    S serenimus

    Hallo! I have a textbox , (made with Zendform), and y load the results of an array in this textbox with the autocomplete(); function , this was performing as expected a few days ago, but today the result is disgusting..the results appear by the textbox this way: .Galicia .Asturias .[...] this function its asociated with a"keyup" event...please any idea of what could be wrong??, I executed in Chrome, and the compilator, shows no errors... :omg: thanks!! ;) so let´s go to the code $(document).ready(function(){ var comunidades=[ "Galicia", "Asturias", "Cantabria", "Islas Baleares" ]; <pre> $("#comu").keyup(function(){ $(this).autocomplete({ source:comunidades }); }); </pre> <pre> <label>Comunidad</label> <?php $fComu=$formNewClienteHotel->get("comunidad"); echo $this->formInput($fComu); ?> </pre> This is the class where the Form is declared:

    setAttributes(array(
    'action'=>'',
    'method'=>'post'
    ));

    	$this->add(array(
    		'name'=>'comunidad',
    		'attributes'=>array(
    		'type'=>'text',
    		'required'=>'required',
    		'id'=>'comu',
    		
    		)
    	));
    
    JavaScript javascript php data-structures question

  • no me funciona funcion autocomplete Jquery
    S serenimus

    Hola! es mi primer mensaje en el foro..no encontré subforo de jquery,pero espero que sea el sitio adecuado Estoy desarrollando un proyecto con PHP en Zend Framework, y en una vista recojo los datos de nuevo cliente con el típico formulario. hay que introducir (en textbox) 1º Comunidad y 2º Provincia..la idea es que si el usuario teclea "Galicia" en el siguiente textbox se muestren sus provincias... el caso es que el primer autocomplete funciona, pero el segundo, no y no se que estoy haciendo mal, no me da error el debuger de Chrome, he probado en Firefox, y tampoco..agradecería algo de ayuda Dejo un copy paste de codigo..gracias por anticipado :)

    	 $(document).ready(function(){
    		 
    	  var comunidades=\[				
    		  "Galicia",			  
    		  "Asturias",
    		  "Cantabria",
    		  "Euskadi",
    		  "Navarra",
    		  "Cataluña",
    		  "Comunidad Valenciana",
    		  "Murcia",
    		  "Andalucia",
    		  "Canarias",
    		  "Baleares"     
    		  \];
    		  
    		    var provingal=\[
    			"La Coruña",
    			"Lugo",
    			"Orense",
    			"Pontevedra"
    			\];
    		  
    
    		  /\*esta parte funciona..el textbox se llena con los resultados\*/
    		  $("#comu").keyup(function(){
    			
    			  $(this).autocomplete({
    				  source:comunidades
    			  });
    			  
    		  });
    		  
    		  
    		  
    		  $("#provin").keyup(function(){
    
    			  var comu=document.getElementById("comu").value;
    			 
                                  /\*el debug llega al switch,pero autocomplete no funciona aqui\*/
    
    			  switch(comu)
    			  {
    				  case"Galicia":
    					$(this).autocomplete({
    						source:provingal
    					}); 
    					
    					break;
    			  }
    		  });
    		  
    					  
    		}); 
      </pre></x-turndown>
    
    JavaScript php javascript debugging help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups