I am using a dialog box to update my database and remove services.
Unfortunately it only works for the first "remove" click.
So, I click to open the dialog box. am faced with a list of 5 services.
I click to remove the 5th service, the db is updated, the list (inside the dialog) reloads and the select tag (on the main page) reloads okay.
If I then repeat this step with the 4th service nothing happens, none of: db update, list update and select update
My jquery handler is below, does anycody know why this isn't working?
$(function () {
$(".deletesector").click(function () {
var name = $(this).attr('name');
var dataString = 'serviceid=' + name;
$.ajax({
type: "POST",
url: "./ajax/remove-service.php?" + dataString,
dataType: "html",
data: dataString,
success: function (msg) {
//UPDATE THE SELET BOXES CONTAINING THE SERVICES
$("#service1-holder").load('./views/service-list1.tmp.php');
// UPDATE THE LIST OF SERVICE
$("#list-of-services").load('./views/list-of-services-for-removal.php');
}
});
});
});
$(document).on("click", ".deletesector", function() {