Search
 
SCRIPT & CODE EXAMPLE
 

PHP

using a php array in jquery

<?php
	// PHP Array
  $names = array('John', 'Doe', 'Joe');
?>

<script>
  // Convert the data to JSON format
	let users = <?php echo json_encode($names); ?>;
	alert(users[0]); // It output John
</script>
Comment

PREVIOUS NEXT
Code Example
Php :: cast array to object php 
Php :: php sha256 
Php :: php date and time 
Php :: add days to date with laravel 
Php :: laravel get random row 
Php :: laravel find or fail exception 
Php :: get url php 
Php :: check if number is float in php 
Php :: change php max upload size 
Php :: how to delete image from aws using laravel 8 
Php :: woocommerce-cart-count 
Php :: codeigniter 3 insert 
Php :: composer memory limit 
Php :: Your Composer dependencies require a PHP version "= 7.3.0" 
Php :: how to calculate days between two dates in php 
Php :: wp get term link 
Php :: php create temporary file 
Php :: php newline 
Php :: laravel flutter save image in data 
Php :: http error 500 phpmyadmin 
Php :: check if date between two dates laravel eloquent 
Php :: doument root phpp 
Php :: laravel grouping routes 
Php :: center mode slick slider 
Php :: new line in php 
Php :: excerpt length wordpress 
Php :: php format datetime 
Php :: php 301 redirect 
Php :: how to add shortcode in html 
Php :: extract all arrays from sql response in php 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =