First of all, this script only works with Safari 3+.
Just replace NAME with the name of the form you are submitting and LOCATION with the URL of the web page.
tell application "Safari"
if (count of windows) is 0 then make new document
tell front window to set newtab to make new tab with properties {URL:LOCATION}
do JavaScript "setInterval(function(){if(/loaded|complete/.test(document.readyState)){document.getElementsByName(\"NAME\")[0].submit();}}, 3)" in newtab
end tell
It uses setInterval to check for the status of page loading, which should be a more robust solution. An even better way would be to use “document.onload = function() {};”, but I couldn’t get it to work.