If you really want it in a single line, try this:
<a href="#" onclick="$('body').append('<form id=\'submitme\' method=\'POST\' action=\'/logout\'></form>');$('#submitme').submit();return false;">
Sign out
</a>
http://jsfiddle.net/TrueBlueAussie/wWj2M/
I have tried this fiddle in these browsers successfully:
- IE
- Chrome
- Firefox
Note: your original did not generate "complete" HTML, so I added missing quotes and closing form element.
Also tested now with a self-closing form tag, but that is not allowed so stick with the example above.