title: Stop PHP code executing after it's ran vue form
body: <p>I have the following vue form</p>
  
  <pre><code>&lt;FlashMessage message="Message sent!" :show="showMsg" /&gt;
  
  &lt;form @submit.prevent.stop="onSubmit" ref="ticketForm"&gt;
    &lt;div class="mb-4"&gt;
      &lt;label class="block" for="name"&gt;
        &lt;span class="text-gray-900"&gt;Full name&lt;/span&gt;
        &lt;input
          class="form-input mt-1 block w-full outline-none"
          placeholder="Sherlock Holmes"
          v-model="formData.name"
          required
          id="name"
          name="name"
          type="text"
        /&gt;
      &lt;/label&gt;
    &lt;/div&gt;
  
    &lt;div class="mb-4"&gt;
      &lt;label class="block" for="email"&gt;
        &lt;span class="text-gray-900"&gt;Email address&lt;/span&gt;
        &lt;input
          class="form-input mt-1 block w-full outline-none"
          placeholder="sherlock@bakerstreet.com"
          v-model="formData.email"
          required
          id="email"
          name="email"
          type="email"
        /&gt;
      &lt;/label&gt;
    &lt;/div&gt;
  
    &lt;div class="mb-4"&gt;
      &lt;label class="block" for="department"&gt;
        &lt;span class="text-gray-700"&gt;Department&lt;/span&gt;
        &lt;select
          class="form-select mt-1 block w-full outline-none"
          name="deptid"
          v-model="formData.deptid"
        &gt;
          &lt;option value="1"&gt;General Support&lt;/option&gt;
          &lt;option value="5"&gt;General Support&lt;/option&gt;
          &lt;option value="2"&gt;Hosting Support&lt;/option&gt;
          &lt;option value="3"&gt;Domain Support&lt;/option&gt;
          &lt;option value="4"&gt;Game Support&lt;/option&gt;
        &lt;/select&gt;
      &lt;/label&gt;
    &lt;/div&gt;
  
    &lt;div class="mb-4"&gt;
      &lt;label class="block" for="message"&gt;
        &lt;span class="text-gray-900"&gt;Message&lt;/span&gt;
        &lt;textarea
          class="form-input mt-1 block w-full outline-none h-56 resize-none"
          placeholder="Enter your message here"
          v-model="formData.message"
          name="message"
          id="message"
          cols="30"
          rows="10"
          required
        /&gt;
      &lt;/label&gt;
    &lt;/div&gt;
  
    &lt;div class="flex mt-6"&gt;
      &lt;label class="flex items-center"&gt;
        &lt;input type="checkbox" class="form-checkbox" /&gt;
        &lt;span class="ml-2"&gt;
          I agree to the
          &lt;a href="#" class="underline"&gt;privacy policy&lt;/a&gt;
        &lt;/span&gt;
      &lt;/label&gt;
    &lt;/div&gt;
  
    &lt;div class="flex mt-6"&gt;
      &lt;label class="flex items-center"&gt;
        &lt;button
          type="submit"
          name="ticketSubmit"
          value="Submit"
          class="flex items-center py-3 px-6 border rounded bg-gray-800 hover:bg-gray-900 font-medium text-white transition duration-300 ease-in-out"
        &gt;
          &lt;i class="fas fa-paper-plane mr-4"&gt;&lt;/i&gt;
          Send
        &lt;/button&gt;
      &lt;/label&gt;
    &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>and I have the following script</p>
  
  <pre><code>&lt;script&gt;
  import axios from "axios";
  import FlashMessage from "../components/FlashMessage";
  import FeaturesWGrid from "../components/FeaturesWGrid";
  import Grid from "../components/Grid";
  import GridItem from "../components/GridItem";
  
  export default {
    name: "Contact",
    components: {
      FlashMessage,
      FeaturesWGrid,
      Grid,
      GridItem
    },
    data() {
      return {
        showMsg: false,
        formData: {
          name: "",
          email: "",
          deptid: "1",
          message: ""
        }
      };
    },
    methods: {
      onSubmit: async function() {
        this.showMsg = true;
        await axios.post("/backend/contact.php", this.formData);
        setTimeout(() =&gt; {
          this.showMsg = false;
        }, 3000);
      }
    }
  };
  &lt;/script&gt;
  </code></pre>
  
  <p>This shows a submit message, but when I submit it hits the PHP file and keeps loading until it times out. How do I stop the file from loading once all the code has been run whilst staying on the same page?</p>
  
  <p>For some more context here is the PHP file</p>
  
  <pre><code>&lt;?php
      $whmcsUrl = "";
      $api_identifier = "";
      $api_secret = "";
      $name = $_POST["name"];
      $email = $_POST["email"];
      $deptid = $_POST["deptid"];
      $message = $_POST["message"];
  
      // Build post values
      $postfields = array(
          'action' =&gt; 'OpenTicket',
          'identifier' =&gt; $api_identifier,
          'secret' =&gt; $api_secret,
          'deptid' =&gt; $deptid,
          'name' =&gt; $name,
          'email' =&gt; $email,
          "subject" =&gt; "Contact form Inquiry from $name",
          'message' =&gt; $message,
          'priority' =&gt; 'Medium',
          'useMarkdown' =&gt; 'false',
          'responsetype' =&gt; 'json',
      );
  
      // Call the API
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, $whmcsUrl . 'includes/api.php');
      curl_setopt($ch, CURLOPT_POST, 1);
      curl_setopt($ch, CURLOPT_TIMEOUT, 30);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
      curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postfields));
      $response = curl_exec($ch);
      if (curl_error($ch)) {
      die('Unable to connect: ' . curl_errno($ch) . ' - ' . curl_error($ch));
      }
      curl_close($ch);
  
      // Decode response
      $jsonData = json_decode($response, true);
  
      // Dump array structure for inspection
      var_dump($jsonData);
  
      exit;
  ?&gt;
  </code></pre>
  
  <p>PHP code</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
      $whmcsUrl = "";
      $api_identifier = "";
      $api_secret = "";
      $name = "";
      $email = "";
      $deptid = "";
      $message = "";
  
      if (isset($_POST['name'])) {
          $name = $_POST['name'];
      }
  
      if (isset($_POST['email'])) {
          $email = $_POST['email'];
      }
  
      if (isset($_POST['deptid'])) {
          $deptid = $_POST['deptid'];
      }
  
      if (isset($_POST['message'])) {
          $message = $_POST['message'];
      }
  
      // Build post values
      $postfields = array(
          'action' =&gt; 'OpenTicket',
          'identifier' =&gt; $api_identifier,
          'secret' =&gt; $api_secret,
          'deptid' =&gt; $deptid,
          'name' =&gt; $name,
          'email' =&gt; $email,
          "subject" =&gt; "Contact form Inquiry from $name",
          'message' =&gt; $message,
          'priority' =&gt; 'Medium',
          'useMarkdown' =&gt; 'false',
          'responsetype' =&gt; 'json',
      );
  
      // Call the API
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, $whmcsUrl . 'includes/api.php');
      curl_setopt($ch, CURLOPT_POST, 1);
      curl_setopt($ch, CURLOPT_TIMEOUT, 30);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
      curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postfields));
      $response = curl_exec($ch);
      if (curl_error($ch)) {
      die('Unable to connect: ' . curl_errno($ch) . ' - ' . curl_error($ch));
      }
      curl_close($ch);
  
      // Decode response
      $jsonData = json_decode($response, true);
  
      // Dump array structure for inspection
      var_dump($jsonData);
      var_dump($_POST)
  ?&gt;
  </code></pre>
  
  <p>So once this code gets ran, how do I stop it from loading so it still sends the data but doesn't sign out.</p>