Firstly, take a look at the documentation for making plugins: http://docs.question2answer.org/plugins/
You'll want to output a form using your widget, and make it post to your ask page, e.g.
<form method="post" action="/ask">...</form>
Don't forget you'll also need the CSRF token in the form, which you can get with qa_get_form_security_code('ask') then put in a hidden input field.
Also take a look at the code of the Ask Box widget (from /qa-include/plugins/qa-widget-ask-box.php) because that already does the "add detail" functionality that you want.
Hope that helps!