Error in PHP ajax response

Asked

Viewed 33 times

0

I’m supposed to be asking to access the page php register. what should make the code and pass whether the registration was well done or not , ams instead it simply copies to the Alert, in sucess, the php code in full, not pecebo why, someone can help me ??

javascript :

function submeterRegisto(){
$.ajax({
    url: "registo.php",
    type: "POST",
    data:   $('tabelareg').serialize(),
    dataType:'HTML', 
    success: function (response) {                 
    alert("sucesso: "+ response);
    },
    error: function(jqXHR, textStatus, errorThrown) {
       console.log(textStatus, errorThrown);
    }
});

PHP:(for example)

php register.

 <?
    if($_POST['confpass'] == $_POST['pass']){
        $email=$_POST['email'];
        $nome=$_POST['name'];
        $pass=$_POST['pass'];

        echo"registo completo (teste)";
    }else
        echo"não compelto (teste)";
  ?>

When I do Submit on the website: inserir a descrição da imagem aqui

  • 1

    In php register. alter <? for <?php

  • Can you access a. php page normally at the same level as the.php registry folders? Because this type of behavior and failure in the connfiguration of the PHP server.

  • Really changing from <? to <?php has already worked properly, thank you very much

No answers

Browser other questions tagged

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