Javascript to call PHP function



I'm really stuck with one javascript...

<SCRIPT TYPE="text/javascript">

[url removed, login to view]("<?php include("[url removed, login to view]"); ?>");

// test php returns echo "ok";

var Balance = 10;

if (Balance != 0)


var string = "<?php GetBalance(50);?>";

[url removed, login to view](string);



// PHP

function GetBalance($balance){

echo $balance;


this prints 50 and is working fine.

the problem is, I want to make it use JS Balance var.

something like <?php GetBalance(Balance);?>

but I can't make it work...

I'm looking for simple, one line solution :)

Skills: Javascript, PHP

See more: call php function javascript, javascript call php function, javascript call php, call function php javascript, javascript function call php, call php function, the string problem, test js, string problem, php function for, m string, call work, call php javascript function, call php javascript, php.js, php test, php function , one line php, javascript to c++, function, simple function, call function, working string, script function, write test script

Project ID: #771331

Awarded to:


ready to start

$50 USD in 0 days
(8 Reviews)

3 freelancers are bidding on average $77 for this job


i am ready to help you

$30 USD in 1 day
(6 Reviews)

We can have the issue resolved in 24 hours after finalisation.

$150 USD in 1 day
(0 Reviews)