“cara menjalankan php di js” Kode Jawaban

cara menjalankan php dalam javascript

// PHP is a Server Side Language, and JS is a Client Side Language, so the simple answer is  
// you can not "run php in javascript". You CAN, however, use PHP to render an html 
// page that includes js code on the server, including php variables, and deliver that page to the client where the javascript will be executed.

PHP Server-side EX:
<!doctype html>
<html lang="en" class="h-100">
  <body>
		<h1>Hello World</h1>
		<script type="text/javascript">
			var Javascript_variable = <?php echo $php_variable; ?>;
		</script>
	</body>
</html>

JS Client-side EX:
<script type="text/javascript">
	var Javascript_variable = "some string from the above php variabe";
</script>
PDXfoster

cara menjalankan php di js

alert("<?php echo "asdasda";?>");
Rht

Jawaban yang mirip dengan “cara menjalankan php di js”

Pertanyaan yang mirip dengan “cara menjalankan php di js”

Lebih banyak jawaban terkait untuk “cara menjalankan php di js” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya