My php ajax jquery form request sometimes fire twice maybe 2 out of 10 does that

Below is my code to submit the form.
8 out of 10 request sent works fine, while the others fires twice or thrice and yet return a single response for sweet alert display.
I make use of sweet alert confirmation before sending request so as to be sure of not clicking twice the submit button before processing. Yet the issue persist, kindly assist further

// My actions.php code all variables used inside the function postrayer are correctly declared without any error
//$wizz is an array of numbers exploded for verification

  $mobiler = isset($_POST['mobile']) ? isints($_POST['mobile']) : '';

  $mobile = in_array($mobiler, $wizz)? false :$mobiler;

//Code to declined and exit with response if $ false is declared here

$postrayer = begins($userid, $wallet, $chan, $mypin,  $mobile, $amountsplit);  

    If ($postrayer){           

//apiFunction is a function to send http request and it is being declared below

function apiFunction ($url,$payload,$token){

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$headers = [


'Content-Type: application/json'


curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$dataapi = curl_exec($ch);


return $dataapi;

$fg = apiFunction ($url,$payload,$token);

       $api_result = json_decode($fg,true);

If($api_result['Status'] == 'successful' ){

// I echo my result to sweet alert

8 out of 10 form request will work perfectly, but the remaining will send request twice or thrice
I can’t monitor this from the network tab because it seldomly happens and I don’t know when precisely it will.
And this is for transactional purpose
Please help

Sponsor our Newsletter | Privacy Policy | Terms of Service