How to pass parameters to an ajax object and reinitiate a request

each ajax is defined as an object because there are more ajax queries in the page and $. When (), is used. For example,

var a1 = $.post({
        url : "/report/A/rank/1",
        data: p1,
        contentType:"application/json;charset=UTF-8",
        dataType : "json",
        success : function(data, textStatus, jqXHR) {}
    });
var a2 = $.post({
        url : "/report/A/rank/2",
        data: p1,
        contentType:"application/json;charset=UTF-8",
        dataType : "json",
        success : function(data, textStatus, jqXHR) {}
    });
$.when(a1, a2).done(function(r1, r2) {
//
});

now, due to some other requirements, I want to dynamically reload a1Maga2 and $.when (a1Magina2), and change the incoming parameter to p2.

alternative: encapsulate the code of the three objects into a function for processing. However, as there are already many ajax on the page and are encapsulated by function, if you encapsulate the code again on this basis, it will affect the readability of the code. Is there a simple way to call it?

Mar.09,2021

Let p1 release p2 first, and then execute a1Magneaa2 recover.resume. If p1 wants to restore the default, re-assign the value to p1 in the callback of when.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b192-2c26f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b192-2c26f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?