Skip to content

Latest commit

 

History

History
50 lines (41 loc) · 639 Bytes

JavaScript_JQuery.md

File metadata and controls

50 lines (41 loc) · 639 Bytes

Javascript

Flujos de control

foreach

$.each(<variable>,function(){
 /// codigo
});

TIPS

Peticiones ajax

$.ajax({
  url: "lorem.ipsum.com/dolor",
  type: "POST",
  dataType:'json',
  delay:250,
  cahe: false,
  data : {
   "dato" : 1
  },
  success : function(){
  }
});

Array to json

 var array = [1,2,3];
 var json = JSON.stringify(array);

Json to array

 var json = JSON.parse(array);

Sleep

 var time = 2000;
 setTimeout(function(){
   /// CODE
 }, this.time);
  • time , time en milisegundos 2000 = 2 segundos