Creating a admin widget for /wp-admin/post.php?

For one, Dashboard widgets (what you’re using in the example) are for the main wordpress admin page.

I think what you want is this tutorial. You also want to look at add_meta_box to look at how to add a metabox to your post screen. Here’s some code from my current project that should help you to add a metabox to the post edit screen.

$m_visitor_info = array(
        'id' => 'argus_edit_visitor',
        'name' => 'Visitor Information',
        'cb' => array( &$this, '_argus_edit_visitor' ),
        'type' => 'visitor',
        'context' => 'normal',
        'priority' => 'high',
    );

add_meta_box( $m_visitor_info['id'], $m_visitor_info['name'], $m_visitor_info['cb'], $m_visitor_info['type'], $m_visitor_info['context'], $m_visitor_info['priority'] );

Change all to suit your preferences. Basically this creates me a custom metabox that appears as the primary input selection for the post (I don’t use editor or title support). Context can either be “normal,” “advanced,” or “side.” I haven’t found a use for ‘advanced’ though it’s default for some reason..

Anyway, You’ll probably need to throw in a check to see whether you’re editing an existing page or you’re creating a new post.

Though, a better solution perhaps would be to use add_action to hook the save_post event and use your ajax there to save the post ID to your external database.