For short amount of text (fitting in the parameters of an URL), one can use, in classical Processing, loadStrings with an URL to transmit these parameters. If loadStrings works this way in PJS too, it can be simpler for you...
I suggested Ajax because I didn't know the size of the data you needed to transmit.