This seems to be part of the problem:
The javascript is not first evaluated! (look in my ajax success response)
The response is just a string, so there exists no DOM element with class "updated".
I temporarily fixed it this way in my plugin, but some core developer could think this through.
Because when you now enter the page directly via the URL you get a hidden hardcoded <div> and one from the js.
Code:
$(response).find('div.updated').html()
The response is just a string, so there exists no DOM element with class "updated".
I temporarily fixed it this way in my plugin, but some core developer could think this through.
Because when you now enter the page directly via the URL you get a hidden hardcoded <div> and one from the js.
Code:
<?php
if (isset($msg)) {
if ($canUndo) $msg .= ' <a href="load.php?id=myplugin&undo">' . i18n_r('UNDO') . '</a>'
?>
<script type="text/javascript">
$(function() {
$('div.bodycontent').before('<div class="<?php echo $isSuccess ? 'updated' : 'error'; ?>" style="display:block;">'+
<?php echo json_encode($msg); ?>+'</div>');
$(".updated, .error").fadeOut(500).fadeIn(500);
});
</script>
<!-- THE DIRTY TEMPORARY FIX -->
<div class="<?php echo $update ? 'updated' : 'error'; ?>" style="display:none;visibility:hidden;height:0;margin:0;padding:0;border:0;"><?php echo $msg; ?></div>
<?php
}
?>