when i do a save an ? sign appears in the URL, before the #
http://localhost:8000/html/WebChecker/www/?#signin
The code of the save is the next
signin : function(){
var logi = document.forms['signin']['name'].value;
var mail = document.forms['signin']['email'].value;
var passwd = document.forms['signin']['pass'].value;
var hash = CryptoJS.SHA256(passwd).toString(CryptoJS.enc.Hex);
var tkn=Math.random(9) * 123123123;
var user = new User({'login' : logi, 'email' : mail, 'pass' : hash, 'token': tkn.toString(), 'recovery' : null, 'img': 'default.png'});
//var user = new User({'user' : logi, 'pass' : hash});
user.save({},{
wait : true,
success : function(response){
alert("OK");
alert(response.res);
Backbone.history.navigate("", {trigger: true});
},
error : function(options){
alert('ERROR');
Backbone.history.navigate("#signin", {trigger: true});
}
});
And the php post function is:
try{
$pdo = conectar();
$insertar = $pdo->prepare('INSERT INTO user (login, email, pass, name, token, recovery, img) VALUES (:login, :email, :pass, :name, :token, :recovery, :img ); ');
$insertar->bindParam(':login', $data->login);
$insertar->bindParam(':email', $data->email);
$insertar->bindParam(':pass', $data->pass);
$insertar->bindParam(':name', $data->login);
$insertar->bindParam(':token', $data->token);
$insertar->bindParam(':recovery', $data->recovery);
$insertar->bindParam(':img', $data->img);
$insertar->execute();
$id = $pdo->lastInsertId();
echo "{'res' : 'ok', 'id' : ".$id."}";
$pdo = null;
//$pdo = null;
}catch(PDOException $e){
If anybody knows the reason...
Thank you