0

I have a long php script and I want when I run the script to show loading gif and a text next to it depending on the code response. just like when you register an account with protonmail

<?php
if (isset($_POST['submit'])){
    $first_name = $_POST['first_name'];
    $last_name = $_POST['last_name']
// script 1
............
if ($val == 'ok'){
    $script1_response = 'ok';
}
else {
    $script1_response = 'fail';
    die();
}
// script 2
............

if ($val == 'ok'){
    $script2_response = 'ok';
}

else {
    $script2_response = 'fail';
    die();
}
// script 3
............

if ($val == 'ok'){
    $script3_response = 'ok';
}
else {
    $script3_response = 'fail';
    die();
}
// done
$response = 'all good'; 
}
?>
  • i don't know how to integrate ajax loading and text response..i search for some model..thank you – Daniel Binotti Nov 09 '20 at 10:46
  • 2
    There is no ajax involved in my suggested post – Alon Eitan Nov 09 '20 at 10:48
  • I have to execute multiple curl requests, each curl returns a code, based on the code I would like a message to appear next to loading gif .. – Daniel Binotti Nov 09 '20 at 10:50
  • While Alon's suggestion could work, AJAX is probably a nicer solution these days. If you don't know how to use AJAX, please find some tutorials, we're not here to teach you what you can learn in a class. If you've tried to use it, and have a specific problem, please show your code where you attempted it, and explain the issue. – ADyson Nov 09 '20 at 10:57

0 Answers0