Send data stay on the same page

0

I would like my input's text FROM / TO save to my xml file (write)

When I click on send when I go to my xml file, until it appears in the file details the date and time that I clicked 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   

    
asked by anonymous 11.04.2018 / 14:22

0 answers