Send data stay on the same page

Asked

Viewed 117 times

0

I would like my input’s text DE/PARA to write to my xml file (write)

When I click send when I go to my xml file ,it even appears in the file details the date and time I clicked to send , and when I open the xml file does not appear what I typed in the fields.

my js file :

$(document).ready(function(){

$("#btnCadastrar").click(function(){//botao do form

    var objForm = $( "#formCadastrar" );

  //  $.post("xt_cadastrar.php", objForm.serialize(), function(data, status){

        // alert("Data: " + data + "\nStatus: " + status);

        $.ajax({
            type: 'POST',
            url: 'cadastrar.php',
            data: {rel:tmp},
            dataType: 'json',
            success: function(data) {
              //$('body').append(data);
              alert("Inserido com sucesso");
           }


    });

    return false;

});    

});

be right ?? my javascript file ?

My form

<form id="formCadastrar" action="xt_cadastrar.php">
    <div class="modal-footer"></div>
    <div id="form-messages">

    <table id="example" class="table table-striped table-bordered">
        <thead>
            <tr>                          
                <th>DE</th>
                <th>PARA</th>                                     
                <th>Situação</th>               
            </tr>
        </thead> 

   $doc = simplexml_load_file('XMLFromSectionToSection.xml') or die("Arquivo não encontrado"); 



<tr>  
    <td name="source"> 
        <input id="typeahead" name=source[] class="typeahead" type="hidden" value="<?php echo $linha["de"];?>"> 
    <?php echo $linha["de"];?> 
    </td>
    <td style="text-align:center;"> 
        <?php if ($linha["status"] != "existe"): ?>
            <input id="typeahead" name=destination[] class="typeahead" type="text" size="75"  placeholder="Sobreescrever"> 
        <?php else: ?>
            -
        <?php endif;?>
        </td>
        <td>       
            <?php if ($linha["status"] == "existe"): ?>
                <span class="badge badge-success">Existe</span>
            <?php else: ?>    
                <span class="badge badge-danger">Não Existe</span>
        </td>
    <?php endif; ?>
</tr>
<?php endforeach; ?>

    <button id="btnCadastrar" class="btn btn-secondary" >Enviar</button>
    <!-- <button id="btnCadastrar" type="submit" onclick="executar()"  id="btnEnviarDados"  class="btn btn-secondary" >Enviar</button> -->
    <button type="reset" class="btn btn-default"  value="Limpar">Limpar</button>

    </div>

System screen inserir a descrição da imagem aqui

  • 1

    Missing javascript code, or html, you are using Datatables?

  • Yes @Wictor Keys I am using data Tables in the display

  • Who asked was @Sveen ;)

  • kkkkkk exact!!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.