1
on a page I have this field filled with the value "SP"
<input id="campo" value="SP">
In php I have parameter
<?php
echo $_POST['estado'];
?>
to process this field via ajax I would use
var valor=$('#campo').val();
in the ajax request,
data: {estado: valor},
what I want is to pass this parameter 'state' also within a variable
var string="estado";
so that in the ajax request it looks like this:
data: {string : valor},
my code
    <script type="text/javascript">
    $(document).ready(function () {
    var string="estado";
    var valor=$("#campo").val();
    ajsjax(string,valor);
    });
    </script>
function ajsjax(string,valor){
    $.ajax({
    type: "POST",
    dataType: "html",
    url: "postos/cadastro_pegar_items.php", 
    data: {string : valor} , //as informações nao chegam aqui da forma correta
    success: function(data){
        alert(data);
    }});
}
						
you want the
databe dynamic?– user8545
Take a look at my answer.
– user8545
This link is blocked here in the company.
– user8545