how use php query in AJAX jquery

You need to edit the PHP associated with the AJAX action call_post. If you want to return different data, you should pass a parameter in the request that you handle later;

data:"action=call_post&template=custom&"+checked,

Ideally, you could just return the data rendered from php with a flag

data:"action=call_post&template=custom&format=html&"+checked,

From a PHP perspective, you would find your parameters in $_GET, $_POST or $_REQUEST.


Scripts

<script type="text/javascript">
    jQuery(document).ready(function () {
        jQuery('.br').click(function () {
            jQuery('.contents').remove();
            var checked = jQuery('#test').serialize();

            jQuery.ajax( {

                url: "<?php echo admin_url('admin-ajax.php'); ?>",

                data: "action=call_post&template=content&" + checked,

                success: function (result) {

                    jQuery(result).appendTo('.mobile_brand');
                }
            });
        })
    });
</script>

functions.php

add_action('wp_ajax_call_post', 'call_post');
add_action('wp_ajax_nopriv_call_post', 'call_post');

function call_post()
{
    $params = wp_parse_args ( $_REQUEST, array(
      'mobile' = 'some-default-brand',
      'template' = '',
    ));

    $brand = $params['mobile'];

    $args = array(
        'post_type' => 'post',
        'meta_query' => array(
            array(
                'key' => 'brand',
                'value' => $brand, 
            ) ,
        ) ,
    );
    $query = new WP_Query($args);

    if( ! empty ($params['template'])) {

      $template = $params['template'];

      // loop through your query here and render the HTML using $template

      // ...

      // then kill the request

      die();

    } else {

      // or send back the posts as json

      wp_send_json($query->posts);

    }
}

error code: 523