buy lasix http://all-treatment.org/buy-levitra-vardenafil/ http://all-treatment.org/buy-viagra-sildenafil-citrat/ isotretinoin online buy cialis online
16 ag. 2017

jQuery vs JS

Author: Joaquim Perez Noguer | Filed under: Web

Al final  quan el Javascript hagi evolucionat prou, el  jQuery ja no serà necessari.

Però he de dir que jQuery força al programador a programar d’una manera elegant i ordenada. Tant de bo quan jQuery no faci falta es continuï utilitzant la mateixa elegància.

Vegeu més exemples a: https://css-tricks.com/now-ever-might-not-need-jquery/?utm_source=frontendfocus&utm_medium=email

jQuery:

var $elem = $(".someClass") //select the element 
$elem.remove(); //remove the element

Without jQuery:

var elem = document.querySelector(".someClass"); //select the element
elem.remove() //remove the element

 

jQuery:

$.ajax('https://some.url', {
  success: (data) => { /* do stuff with the data */ }
});

Without jQuery with  new fetch API is a superior replacement for XMLHttpRequest and is now supported by all modern browsers.

fetch('https://some.url')
  .then(response => response.json())
  .then(data => {
    // do stuff with the data
  });

 

 

 



Leave a Reply