AJAX is not working

Asked

Viewed 29 times

0

Does anyone know why this AJAX isn’t it working? The variables are receiving the values, only the part of sending the data to actualiza.php is that it doesn’t work.

$("#btnedit").click(function(){
        var proc=$("#procedit").val();
        var nome=$("#nomeedit").val();  
        var cc=$("#ccedit").val();
        var data_nasc=$("#data_nascedit").val();

        alert(proc);
        alert(nome);
        alert(cc);
        alert(data_nasc);

            $.post("actualiza.php",{ proc: proc, nome: nome, cc: cc, data_nasc: data_nasc },
                function(data)
                {
                        $("html").html(data);
                });      

        });
  • What actualiza.php should return? If possible, add the return leg of this page.

  • Have you checked whether a request is sent to "update.php"? What are the criteria to determine if it failed? the expected content is not added to the "html" element? Why failure might be in the PHP script as well.

  • In the actualiza.php I just have to receive the variables and show them like this: <?&#xA; $n_proc = $_POST['proc'];&#xA; $nome = $_POST['nome'];&#xA; $cc = $_POST['cc'];&#xA; $data_nasc = $_POST['data_nasc'];&#xA;&#xA; echo $n_proc;&#xA; echo $nome;&#xA; echo $cc;&#xA; echo $data_nasc;&#xA;?>

  • 1

    I tested this code here, and as I imagined, a request is sent normally.

  • There was one missing } in the code php, had made a if before sending the variables and had not closed the cycle. But I really thought I had done AJAX badly. Thank you.

  • You need to take a closer look at this to identify exactly where the problem is. Make sure a request is actually made. Check the status of this request. Check that "Function" is executed ...

  • Okay, so this settled :D

Show 2 more comments
No answers

Browser other questions tagged

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