Ajax Send Post Data with Graphic Button
<p>The graphic button below has no value, just an id. I am trying to bring some results from the database when I click on it. I have to get results according to the <em>span</em> inside the graphic button structure. </p>

<pre><code>&lt;a class="uib-graphic-button default-graphic-sizing default-image-sizing hover-graphic-button active-graphic-button default-graphic-button default-graphic-text widget uib_w_10 d-margins media-button-text-bottom" data-uib="media/graphic_button" data-ver="0" id="admin"&gt;
    &lt;img src="images/administrativa.png"&gt;
    &lt;span class="uib-caption"&gt;Admin&lt;/span&gt;
&lt;/a&gt;
</code></pre>

<p>javascript:</p>

<pre><code>$(document).on("click", "#admin", function(evt)
{
    /* your code goes here */

    var dataString = "admin=";
    var $server = "http://localhost/project";

    function SelectAdm(){
        $.ajax({
            type: "post",
            url: $server+"/select.php",
            data: dataString,
            success: function(result, jqXHR){

                var vaga = $.parseJSON(result);

                $.each(vaga, function(index, item){
                    var list_item = '&lt;li class="widget uib_w_17" data-uib="jquery_mobile/listitem" data-ver="0" data-icon="carat-r" id="listitem"&gt;&lt;a href="#"&gt;&lt;span&gt;'+item.CARGO+'&lt;/span&gt;&lt;/a&gt;';

                    $("#list").append(list_item);
                    activate_page("#listpage");

                });

            },
            error: function(jqXHR, status){
                alert("not working");
            }
        });
    }
    new SelectAdm();
});
</code></pre>

<p>php file</p>

<pre><code>&lt;?php 

include_once("conn.php");

if(isset($_POST['admin'])){

$adm = "administrativa";

$sql = $mysqli-&gt;query("SELECT * FROM vagas WHERE area = '".$adm."' ");

if($sql-&gt;num_rows &gt; 0){
    while($row = $sql-&gt;fetch_array(MYSQL_BOTH)){
        $registro = array(
            "AREA" =&gt; $row['area'],
            "CARGO" =&gt; $row['cargo'],
            "ATIVIDADES" =&gt; $row['atividades'],
            "SALARIO_INI" =&gt; $row['salario_ini'],
            "POS_EXPERIENCIA" =&gt; $row['pos_experiencia'],
            "BENEFICIOS" =&gt; $row['beneficios'],
            "HORARIO" =&gt; $row['horario'],
            "ESCOLARIDADE" =&gt; $row['escolaridade'],
            "LOCAL" =&gt; $row['local'],
            "INFOS_ADICIONAIS" =&gt; $row['infos_adicionais']                      
        );

        $retorno[] = $registro;

    }       
}

$mysqli-&gt;close();
$retorno = json_encode($retorno);
echo $retorno;

}

?&gt;
</code></pre>

<p>Am I sending it wrong? When I work with inputs it all works fine, mounting the data like this:</p>

<pre><code>var state = $("#state").val(); 
var city =$("#city").val();
var dataString = "state="+state+"&amp;city="+city+"&amp;submit=";
</code></pre>

<p>How does it work without inputs?</p>