hello i have some problem with my script: i upload image with jquery ajax:
url:"../ajax/upload_media_files.php",
type: "POST",
data: fd,
//dataType: 'JSON',
contentType: false,
cache: false,
processData:false,
beforeSend:function(){
//nothing do
},
success: function (data){
//if upload success refresh div for preview image
update_media_gallery();
}
function update_media_gallery() {
$.get("../ajax/reload_media_gallery.php", function(data) {
$("#list_media_gallery").html(data);
//window.setTimeout(update, 10000);
});
}
all works good, now i have on div reloaded button for delete image in this mode:
$('[id^=delete-]').on("click", function(event){
event.preventDefault();
var elem = document.getElementById(this.id);
//console.log(elem);
var db_name = elem.getAttribute("db_name");
var id_name = elem.getAttribute("row_id");
var files = elem.getAttribute("del_files");
if(id_name == ""){
Toastify({ text: "Ceva nu a mers bine #id_name, contactati administratorul #enable_id", style: {background: '#F06548'}, duration: 3000 }).showToast();
} else if (db_name == ""){
Toastify({ text: "Ceva nu a mers bine #db_name, contactati administratorul #enable_db_name", style: {background: '#F06548'}, duration: 3000 }).showToast();
} else {
$.ajax({
url:"../ajax/delete_db.php",
method:"POST",
data: {id_php: id_name, db_name_php: db_name, del_file: files},
beforeSend:function(){
},
success:function(data){
confirm("Are you sure?");
},
error: function (data) {
console.log(data);
}
});
}
});
But now all js script not work, have any ideea how to fixed?