Ajax function with php is not working

Asked

Viewed 32 times

0

I have this code plus ajax doesn’t even carry a value

  $.ajax({

    url: 'php/vizCliente.class.php',
    type: 'POST',
     data: {
              update:      '1'
            },
    cache: false,
    datatype: "json",
    error: function(e) {
        alert('Erro ao tentar ação! \n'+e);
    },
    success: function(data) {
        alert(data);

    },
  });
});

This is the code in php

final class vizCliente
{

public $update;

public function __construct()
        {

                $this->update           = $_POST['update'];


                if($this->update == '1')
                {
                                    echo $this->update;                        

                }

        }
}
  • And how you did the class instance in PHP?

1 answer

0

Your class is declared in vizCliente.class.php, however there is no instance of the class in this file, you must instantiate the class and fill in its values.

Browser other questions tagged

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