It was working fine. What changes I made, I am unable to trace it out, which has broken it.
But now my Ajax response shows momentarily on the screen and disappear. Using firebug I can see that I am getting the response properly.
I am just been unable to locate, what has gone wrong. This is the code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js">
</script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('.loader').hide();
$("#domain-check").submit(function (event) {
/* Stop form from submitting normally */
event.preventDefault();
/* Clear result div*/
$("#result").html('');
/* Get some values from elements on the page: */
var values = $(this).serialize();
$('.loader').show();
/* Send the data using post and put the results in a div */
$.ajax({
url: "?r=site/check",
type: "post",
data: values,
success: function (response) {
$('.loader').hide();
$("#result").html(response);
}
});
});
});
</script>
and HTML DiV below the form is like this
<div class="loader">
<span></span>
<span></span>
<span></span>
</div>
<div id="result"></div>
Can it be related to some cache issue?