Why doesn’t this work, the #widget-fin div and #wrap div both don’t react?
jQuery.ajax({
type: "POST",
url: "<?php echo dirname(WP_PLUGIN_URL.'/'.plugin_basename(__FILE__)); ?>/save-route.php",
data: str,
success: cb_success
});
var cb_success = function(msg){
if(msg.toString() == "OK")
{
result = '<div class="notification_ok">Save!</div>';
jQuery('div#widget-fine').hide();
}
else
{
result = '<div class="notification_ok">Nothing saved</div>';
}
jQuery('div#wrap').html(result);
//alert('test '+ result);
}
Try putting the definition of cb_success in front of the ajax call. cb_success might otherwise be undefined.