How can i print php variable in jquery?

How can i print php variable in jquery?

In this post we will give you information about How can i print php variable in jquery?. Hear we will give you detail about How can i print php variable in jquery?And how to use it also give you demo for it if it is necessary.

If you are working on php and you need to print your php variable inside the javascript then you can simple get value. you can use “” for get value of php variable. in following example you can see :

Example:

<script type="text/javascript">

var my_var = "<?php echo $my_variable; ?>";

console.log(my_var);

</script>

OR

<script type="text/javascript">

var my_var = <?php echo $my_variable; ?>;

console.log(my_var);

</script>

But, you can use on php file, Not on js file.

Hope this code and post will helped you for implement How can i print php variable in jquery?. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

1  +    =  3

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US