having issue. have 2 different buttons included each image displayed. 1 remove, other assign "main".
remove works. hides image, deletes file, , mysql row.
assign main sort of works. updates row in database changing "main" value 1, should, however, should alert(), not.
<script> $(document).ready(function() { $(".remove_image").click(function() { var image_id = $(this).attr('id'); $.ajax({ type:"post", url:"imagecontrol.php", data: { image_id:image_id, image_remove:1}, success: function(response) { $('#image_'+image_id).fadeout(400); showuploader(); } }) }) }); $(document).ready(function() { $(".assign_main").click(function() { var assign_this_id = $(this).attr('id'); $.ajax({ type:"post", url:"imagecontrol.php", data: { assign_this_id:assign_this_id, image_assign:1}, success: function(response) { alert("success"); } }) }) }); </script>
the success
method called when http 200
or http 304
returned, therefore may need double check see if case.
this can done in ‘inspector’ panel in modern web browsers, under ‘network’ tab.
you can add error: function() {}
event handler catch http 4xx / 5xx codes.
Comments
Post a Comment