How to do a proper refactoring of the ajax requests?

Somewhere 2 months ago, I wrote a lot of code on the principle - "Dwellers worked."
var b = $("body");
b.on(event, element, function (e) {
 // .. code
 // .. code

In short, really a lot of event handlers which send ajax requests to the same file, and everywhere the delegation from the body, the answer is always different, where the json somewhere in the html parameters to be passed too. Size ~ 4K rows.
The first thing I comes to mind is a wrapper function.

How do rewrite it normal? If you can please tell me the library or articles on the subject.
September 26th 19 at 07:33
4 answers
September 26th 19 at 07:35
You need fullajax.

Two option send control command and arguments.
Return two parameters control the command and data.
September 26th 19 at 07:37
Library for refactoring AJAX requests?

Stuff into a single function with the correct arguments and all.
From the main problems it does not deliver, even if I do through arguments or through currying, I can reduce the statement $.ajax({}) and it will be colbecki, and the code running in the main body of the event handler. - karl commented on September 26th 19 at 07:40
September 26th 19 at 07:39
September 26th 19 at 07:41
Compress data that is transferred, use fullajax and think about node.js

Find more questions by tags AJAXJavaScriptRefactoring