vendredi 15 juillet 2016

how to convert a jquery load method to plain javascript, without added libraries?


i have this working ajax code:

$(function(){
  $('#post-list a').click(function(e){
    var url = $(this).attr('href');
    $('#ajax-div').load(url+ " #post");
    e.preventDefault();
  });
});

how do i convert it to plain JavaScript without jquary, or any other libraries? i believe it has something to do with XMLHttpRequest.


Aucun commentaire:

Enregistrer un commentaire