Tag Archives: java

Calling PHP Function within Javascript

Questions: I want to know is it possible to call a php function within javascript, only and only when a condition is true. For example <script type=”text/javascript”> if (foo==bar) { phpFunction(); call the php function } </script> Is there any means of doing this.. If so let me know. Thanks Answers:

javascript clock with server time [duplicate]

Questions: Possible Duplicate: Making Live Clock javascript I want to create a clock, with javascript and php. It should start from a server time (unix timestamp with php) and continue with javascript. How can I create it? In this topic, he said to use Date.now();, but this function return a timestamp with milliseconds, and php… Read More »

Call Java method from PHP5

Questions: There used to be a PHP extension that could load Java libraries and call methods in them. That was for PHP 4. Is there a way to do the same in PHP 5? Answers:

Execute Google Chart API (Javascript) in php file

Questions: I am creating a mail in php, in a wordpress plugin, and would like to include an image created by the google chart api. I tried the following: <?php $message.= <<<HTML <script> google.charts.load(‘current’, { ‘packages’: [‘corechart’] }); google.charts.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ [‘Year’, ‘Sales’, ‘Expenses’], [‘2013’, 1000, 400], [‘2014’, 1170, 460],… Read More »

how to assign javascript variable value to php variable

Questions: I have declared a javascript variable , var myJavascriptVar = 12345; And unable to assign that value to php variable; $myPhpVar = ‘myJavascriptVar’; I know Ajax may be the solution of my problem. But i don’t know how to use Ajax and solve the problem. <html> <body> <script> var myJavascriptVar = 12345; <?php $myPhpVar=’myJavascriptVar’;?>… Read More »

Set JavaScript variable from PHP

Questions: How I can set the JavaScript variable strUser from PHP? I am using the following code: <script> function val() { var e = document.getElementById(“ali”); var strUser = e.options[e.selectedIndex].text; } </script> brand<select id=”ali” onChange=”val()”> <?php $brand=modsearchkhodroHelper::retrieve(); foreach($brand as $item) { ?> <option value=”<?php echo $item[‘brand’]?>” selected=”<?php $id=$item[‘brand’]?>”> <?php echo $item[‘brand’]?> </option> <?php } echo “</select>”;… Read More »