Replace $.ajax by manual method