BJS & PHP...How to combine the 2?

Hey all!!

A few months ago I worked on an awesome PG:
Soon after finishing my mentor hinted at using the code as a base so folks can create their own version of the game and share with others . Well using PHP based framework Laravel I have a space where to folks do so.

My question is how do I connect the 2? Trying to have a somewhat Twitch type site but using code from this PG as a start.

Ive attached pics of site using Laravel(working on it via localhost). Would like to have game showcase on dashboard. Hope Im not being confusing :blush:

:yellow_heart: :orange_heart:,

Use Ajax which allows you to run PHP scripts

 $.ajax({ type: "POST", url: 'script.php', data: "data="+value,
		success: (result) => {
			//Code JS of result

Thank ya Sir for the help :heartpulse:

Having a somewhat difficult time understanding due to the language but looking at code it seems like what I already have. Cant really tell.

Thank ya Sir for the help :heartpulse:

Using this code will allow me to integrate the PG code into the PHP code?

You’re welcome. :blush:

The code I show you is code to use in a js file. This code calls a php file which must contain only PHP code.

The ajax function returns the result of your PHP code in an ‘echo’. You can process this result in Javascript in :

success: (result) {
//JS code

1 Like