Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function registrar($username, $email, $password, $confirm_password)
- {
- try
- {
- $this->has = crypt($password);
- $this->has_con = crypt($confirm_password);
- $p= "soy diferente de uno";
- $registro = $this->conexion->conexion->query("insert into registro_por (nombre, correo, pass, conf_pass) values( '$username', '$email', '$this->has', '$this->has_con')");
- if ($registro)
- {
- return $p;
- }
- else
- {
- throw new Exception("Fallos la ejecución");
- }
- }
- catch (Exception $e)
- {
- echo 'Message: '.$e->getMessage();
- }
- }
- require_once("../Model/registro.php");
- $username = $_POST["username"];
- $email = $_POST["email"];
- $password = $_POST["password"];
- $confirm_password = $_POST["confirm_password"];
- $reg = new Registro();
- $t = $reg->registrar($username, $email, $password, $confirm_password);
- var_dump($t);
- if ($t != 1)
- {
- //return "ok";
- //echo "es difenrete de uno";
- return $t;
- }
- else
- {
- return $t;
- //echo "fail";
- }
- $('#register-submit').click(function () {
- var data = $('#register-form').serialize();
- $.ajax({
- beforeSend: function () {
- console.log(data);
- },
- type: 'POST',
- url: '../Controllers/registro.php',
- data: data,
- success: function (data) {
- console.log('nanananana');
- console.log("soy data"+data);
- }
- });
- });
- error: function (xhr) {
- console.log(xhr.responseText);
- }
- $.ajax({
- beforeSend: function () {
- console.log(data);
- },
- type: 'POST',
- url: '../Controllers/registro.php',
- data: data,
- //Cargando, le agregas un gif a un div
- beforeSend: function () {
- console.log("cargando")
- },
- success: function (data) {
- console.log('nanananana');
- console.log("soy data"+data);
- },
- //Error que mostrará desde PHP
- error: function (xhr) {
- console.log(xhr.responseText);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement