There are two basic approaches you can take.
- Polling
- Server push
Polling is simpler but generally less efficient.
When the HTTP request from the third-party server is received by your server, record the information in it (e.g. in a database).
The page you want to show the result on should use JavaScript (e.g. the XMLHttpRequest object) to make a request to a URL on an interval.
That URL should return the information you stored in the database (or a notification that said data isn't available yet).
Server push is more complicated, but more efficient. The browser keeps a connection open to the server and data can be sent along the connection in either direction at any time. This is usually implemented with Web Sockets.
Either way, you should send data along the connection (i.e. message was received) and not JavaScript. Have the JavaScript that presents the message to the user be part of the code which waits for the message and not part of the message itself.