Am observat ca nu se intra in "success" dar datele se adauga in baza
Am incercat sa adaug codul urmator doar pentru pagina "filme" dar se pare ca nu functioneaza
Cod: Selectaţi tot
RewriteRule ^(filme)(\?)(.*)$ index.php?view=filme&$3 [NC,L,QSA]
Cod: Selectaţi tot
RewriteRule ^([a-zA-z0-9-]+)(\/)?(?(2)([0-9]+))$ index.php?view=$1&id=$3 [NC,L]
Cod: Selectaţi tot
function doSubmit(){
$("#createEventModal").modal('hide');
var title = $('#title').val();
var startTime = $('#startTime').val();
var endTime = $('#endTime').val();
$.ajax({
url: 'filme',
data: 'action=add&title='+title+'&start='+startTime+'&end='+endTime,
datatype: "json",
type: "POST",
error: function(xhr, status, error) {
alert(status);
alert(xhr.responseText);
},
success: function(json) {
$("#calendar").fullCalendar('renderEvent',
{
id: json.id,
title: title,
start: startTime,
end: endTime,
},
true);
alert(title + ' - ' + startTime + ' - ' + endTime + ' - ' + json.id);
}
});
}
Cod: Selectaţi tot
if($_POST['action'] == "add")
{
mysqli_query($con, "INSERT INTO `filme` (
`title` ,
`start` ,
`end`
)
VALUES (
'".mysqli_real_escape_string($con, $_POST["title"])."',
'".mysqli_real_escape_string($con, date('Y-m-d H:i:s',strtotime($_POST["start"])))."',
'".mysqli_real_escape_string($con, date('Y-m-d H:i:s',strtotime($_POST["end"])))."'
)");
header('Content-Type: application/json');
die(json_encode(mysqli_insert_id($con)));
exit;
}