How to make when performing Ajax descent modal window?

Hi.
There is a problem.
Click on the link a window appears with a form a user fills it out, sends - performs an Ajax request to a file send.php.
If the user filled out everything correctly and the request is accepted then issue a greeting.
Here is the code:
$('#form').submit(function(){
 var form_data = $(this).serialize();
$.ajax({
 type: "POST",
 url: "send.php",
 data: form_data,
 success: function(){
$('.thanks').modal('show');
}
});
 });

But for some reason when the query returns TRUE. The window "congratulations" appears but immediately goes off, even if the data in the database went. And the form is also closed but in principle it should be.
The question is, how do I write code so that modal window with a greeting has not been closed?
July 9th 19 at 11:13
1 answer
July 9th 19 at 11:15
below the form is not closed, your code should return false, otherwise, when you return "true" is a real form submit.
try either this:
$('#form').submit(function(){
 var form_data = $(this).serialize();
 // ....
 return false;

either way:
$('#form').submit(function(evt){
evt.preventDefault();
 // ....

Not to paint here manuals on JavaScript, read the article on sending HTML forms.

Find more questions by tags AJAXJavaScriptjQuery