title: Prevent redirect PHP form with red input after submit for 2 se
body: <p>i find this thread here and works perfect for me but i want to evolve a little and to old.. and idk if i will receive any anwsers.. so i need a quick help.
  i use this code and works perfect:</p>
  <p>HTML:</p>
  <pre><code>&lt;form action=&quot;mail.php&quot; method=&quot;POST&quot; onsubmit=&quot;return foo(this);&quot;&gt;
      &lt;input type=&quot;text&quot; name=&quot;full_name&quot; value=&quot;&quot; required&gt;
      &lt;button type=&quot;submit&quot;&gt;submit form&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  <p>JavaScript:</p>
  <pre><code>function foo(form){
      $.ajax({
          url: $(form).attr('action'),
          type: 'POST',
          data: $(form).serialize(),
          success: (res)=&gt;{
              // success...
              console.log(res);
          },
          error: (err)=&gt;{
              // error...
              console.error(err);
          },
          complete: ()=&gt;{
              // something here...
          }
      });
  
      return false;
  }
  </code></pre>
  <p>but i want to integrate also this:</p>
  <pre><code>&lt;script&gt;
              $(document).ready(function(){
                  //alert(&quot;b&quot;);
                  jQuery(&quot;#a&quot;).css(&quot;background-color&quot;, &quot;#ffebed&quot;);
                  jQuery(&quot;#a&quot;).css(&quot;border&quot;, &quot;2px solid #ff3f4c&quot;);
                  setTimeout(function(){
                      //alert(&quot;hello&quot;);
                      jQuery(&quot;#a&quot;).css(&quot;background-color&quot;, &quot;#fff&quot;);
                  jQuery(&quot;#a&quot;).css(&quot;border&quot;, &quot;1px solid #f4f4f4&quot;);
                  $(&quot;#invalidmsg&quot;).hide();
                  
                      $(&quot;a&quot;).val('');
                      $(&quot;a&quot;).val('');
                      $(&quot;a&quot;).val('');
                    document.getElementById(&quot;a&quot;).reset();
                  }, 2000);
              });
              &lt;/script&gt;
  </code></pre>
  <p>after i submit the button i want your help guys to extract/integrate from this javascript after i submit the button to make the input red and reset after 2 sec like here. and also bellow the input a text like &quot;12345&quot;</p>
  <p>and sorry for my bad english. im not expert..</p>