I have an SQL statement written in PHP.
$sql="SELECT Country.* FROM Country";
Below this, out of the PHP, using AJAX, I am reading the value of a selected text box. Depending on it's value, I need to append the PHP $sql string.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script>
    $(document).ready(function() {
        $('select[name="sortBy"]').change(function(){
            var status = $(this).val();
            $.ajax({
                    type: 'POST',
                    url: 'tableCountry.php',
                    data: {changeStatus: status},
                    dataType: 'html'
            });
            if($(this).val() == 'silver'){
                <?php $sql . "ORDER BY silver";?>
            }
        });
    });
</script>
What is the quickest way of doing that? I have tried working with php inside JS after each check but I cannot get anything that works. Thanks.
 
    