MVC Ajax Post
$.ajax({
url: 'http://localhost/webservice/delete_pdf.php',
data: {delete_array: jsonString},
dataType: 'json',
type: 'POST',
success: function(data){
// Retrieve the success_delete array from json response.
var toDelete_Array = data.success_delete;
// Remove the filenames from the displayed list.
//iterate through the success_delete array
$.each(toDelete_Array,function(i, file_name){
// The id of each wrapper_div member is equal to corresponding filename
var x = $('#'+file_name).attr('id');
console.log('id for div: '+ x); <---- this returns 'undefined'
// I have tried $('#'+file_name).remove(); and nothing happens. I am guessing it is due to the 'undefined' id of the div that i am trying to delete.
});
},
error: function(jqXHR, stringMessage, string){
alert(stringMessage);
}
});
}
Comments
Post a Comment