Sharing Data Between VB/JS/Rails

Unfortunately one of the web-apps I am working on has to make changes
through an emulator (Attachmate) to a green screen as well as to the
mySQL DB. The attachmate is being called by the client.

How can I have it so that when I submit the form the changes are made
to the green screen and if they are successful have Rails update it's

This is really ugly and I know it does not have to be. How can I make
it pretty?

Please help :-). At a higher level of abstraction is their a better
way to go about things?

To add to the information, I am using RJS to update that field
presently when I do an update to just the DB. Can I do something in
RJS where it will call VBScript to run the changes on Attachmate and
the if it succeeds then run the update of the DB?