Display "Thank you" message in html on click of button using AJAX
<p>I'm trying to complete an email submission form.</p>

<p>I want to show a thank you message when form is submitted (when submit button is clicked)</p>

<p>This is my current code in index.html fie</p>

<p>I don't want window alert like this</p>

<p><img src="https://i.stack.imgur.com/L7NBc.png" alt="window.alert"></p>

<p>I want to hide email box and subscribe button by displaying "Thank you" message.</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function call_mailm() {

  $.ajax({
    url: "http://google.com/form/" + $("#name").val(),
    success: function(result) {
      alert("Mail sent successfully");

    },
    error: function(error) {
      alert("There is some problem with mail");
    }
  });
  return false;

}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"&gt;&lt;/script&gt;
&lt;!-- Begin  Signup Form --&gt;
&lt;div id="mc_embed_signup"&gt;

  &lt;form&gt;

    &lt;input type="text" id="name" name="email" class="required email" id="email" placeholder="Email Address" style="font-size:15pt;height:38px;width:350px;font- family:Century Gothic;"&gt;

    &lt;div style="position: absolute; left: -5000px;" aria-hidden="true"&gt;
      &lt;input type="text" name="b_438e8df85b7f9df7fce94287a_013c74a5bc" tabindex="-1" value=""&gt;
    &lt;/div&gt;
    &lt;button onclick="return call_mailm()" value="Submit" name="subscribe" id="mc-embedded-subscribe" class="button" style="background-color: rgba(14,46,71,1);border: 1px solid #0E2E47;width:150px;height:37px;font-family: ‘Palatino Linotype’, ‘Book Antiqua’, Palatino, serif;font-size:24px;color:white;"&gt;Subscribe&lt;/button&gt;
    &lt;div id="mce-responses" class="clear"&gt;
      &lt;div class="response" id="error" style="display:none"&gt;&lt;/div&gt;
      &lt;div class="response" id="success" style="display:none"&gt;&lt;/div&gt;
    &lt;/div&gt;
  &lt;/form&gt;

&lt;/div&gt;
&lt;!--End mc_embed_signup--&gt;</code></pre>
</div>
</div>
</p>

<p>inside of  tag like this</p>

<pre><code>&lt;div id="success"&gt;
Congrats! &lt;br&gt;
 Thank you for subscribing
 &lt;/div&gt;
</code></pre>