Revolver 1.0.1: AJAX to Fetch

Today I'm was kill old method for AJAX requsts in Revolver core. Now we have new method based on fetch API. It's cool and looks like good solution.

So ... Now $.fetch supports GET and POST methods and html, text or json data format variants. For example we have to look at POST data transfer to backend from HTML form:

$.event('input[type="submit"]', 'click', function(e) { 
let data = new FormData(); 
let form = $.dom('#test input[type="text"]'); 
for(var j in form) { 
data.append( form[j].name, form[j].value ); 
$.fetch('http://test:88/post.php','POST','text', data, function(){ $.log(this) }); });

In next releases I have to transform code to more ES7 style.

Добавить комментарий