I'm not entirely sure if I've understood this but you could write a submitdata() function in the js which contains the logic to send the data to both pages from the original form so that when you call onclick, you call something like onklick=submitdata() and then that function works out what to send to both pages. I used something like this as a
test to send data to a Perl script and
servlet a while ago though didn't need it for production in the end.
(Yes I know onklick is misspelt but the form won't allow me to submit it correctly - presumably as a safety feature)