Your case:
Javascript :
$('#find-btn').click(function () { if($('#from').val() == 0 && $('#to').val() == 0) { alert("Вы не заполнили поля для поиска!"); return; } else { var findFrom = $('#from').val(); var findTo = $('#to').val(); var data = { from: findFrom, to: findTo }; console.log(data); /*Данные записались*/ $.ajax({ type: 'POST', url: './php/search.php', data: data, success: function(response){ alert("response from search"); console.log(response); }, error: function () { alert("error on ajax search"); /*Ошибок нет*/ } }) } return false; })
PHP :
include('dbconnection.php'); if(isset($_POST['from']) and (isset($_POST['to']))) { echo 'yes!'; /*Тут false*/ }
As Pavel Mayorov replied , both options are identical:
var data = { from: findFrom, to: findTo }; var data = 'from=' + findFrom + '&to=' + findTo;
Simulated the situation, worked: 
For the lazy, you can play like this:
test.php
<script src="https://code.jquery.com/jquery-1.12.3.min.js" integrity="sha256-aaODHAgvwQW1bFOGXMeX+pC4PZIPsvn2h1sArYOhgXQ=" crossorigin="anonymous"></script> <button>ЖМАКНИ</button> <script> $('button').click(function () { var findFrom = 'findFrom_value'; var findTo = 'findTo_value'; var data = 'from=' + findFrom + '&to=' + findTo; console.log(data); /*Данные записались*/ $.ajax({ type: 'POST', url: '/test2.php', data: data, success: function(response){ alert("response from search"); console.log(response); }, error: function () { alert("error on ajax search"); } }) }) </script>
test2.php
<?php if( isset($_POST['from']) and (isset($_POST['to'])) ) { echo 'yes!'; /*Тут false*/ } else echo 'no!';
The question is, if something is marked as general, do not be shy, add, edit.
datavariable format, try it like thisvar data = { from: findFrom, to: findTo }- S. Pronin$_GET, but you accept as$_POST- Vasily Barbashev