Helpful Information
Category: JS
js --> java --> js --> php --> email

OK, i have a Java application online with which I want to achieve the following.

Click a button which fires my javascript function to send a call to the java applet which then generates a random #, which then gets sent back to a javascript function on my page, which writes that random# into a div.

From there I need it to somehow email that random # once it has been received from the java applet, and email it with php.

Sounds easy enough, but this morning my brain is acting like its Monday a.m.

thanks y'all! :thumbsup:

Clarify please. Here's my belief, you verify it:

1) You have a web page
2) You have a Java applet on that web page
3) The server serving 1 and 2 has PHP on it
4) You want to push an HTML button to call a javascript function
5) You want 4 to call a function in the Java applet
6) You want the applet to generate a value that is somehow accesible to the javascript
7) You want to send an email from the server with the value from 6 in it

Is this right?


And i already have steps 1-6 happpening, just not sure how to get that returned value trigger a php mail() function.

ultimately what this is/DOES is this. My application has a button "screenshot" which captures the current state of the applet and retrieves a unique id from the applet. This unique id is the image name on the server that also was generated when the user clicks "screenshot". I need this id to be passed along to the php mail() so I can have the image embedded in the email.

make sense?

So you just send a request to a PHP script with the variable encoded in the query.

You can do this via post or get.

Easiest way is via get with a page refresh:

var uid = getItFromTheApplet();
document.location = "myPHPmailer.php?uid="+uid;

If you dont' want a page refresh you can either create a frame/iframe and set it's document.location to the above or you can create an XMLHTTPRequest (the AJAX technique) and encode the value as either post or get. It's a simple enough problem that you can find all your answers for this on google.

If you need help with the PHP mailer, hit the PHP forums.