Dear Antonio,
passing a variable to javescript I use:
<s cript>
var cTimeDate = <?prg f_timeDate() ?>
</s cript>
function f_timeDate()
local cDatum_Zeit := ""
cDatum_Zeit := "'" + dtoC(date()) + " " + time() + "'"
? cDatum_Zeit
return cDatum_Zeit
//----------------------------------------------------------------//
I seems to me that function is read 2 times. Is this the correct way to get variables from Harbour to JS.
Best regards
Otto
Passing a variable to javescript
- Otto
- Posts: 6403
- Joined: Fri Oct 07, 2005 7:07 pm
- Has thanked: 22 times
- Been thanked: 2 times
- Contact:
Passing a variable to javescript
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
- Antonio Linares
- Site Admin
- Posts: 42511
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 73 times
- Contact:
Re: Passing a variable to javescript
A simpler way:
Code: Select all | Expand
<s cript>
var cTimeDate = '{{dtoC(date()) + " " + time()}}';
</s cript>
- Otto
- Posts: 6403
- Joined: Fri Oct 07, 2005 7:07 pm
- Has thanked: 22 times
- Been thanked: 2 times
- Contact:
Re: Passing a variable to javescript
Dear Antonio,
this is only a sample. Sometimes you have very functions with many lines. Should we program a mechanism that a functions does not execute on loading the page at first.
And it yes how can this be done.
Best regards
Otto
this is only a sample. Sometimes you have very functions with many lines. Should we program a mechanism that a functions does not execute on loading the page at first.
And it yes how can this be done.
Best regards
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
- Antonio Linares
- Site Admin
- Posts: 42511
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 73 times
- Contact:
Re: Passing a variable to javescript
Dear Otto,
> Should we program a mechanism that a functions does not execute on loading the page at first
It will always execute on loading the page at first only
If you want to execute Harbour code later on, then you need to call the server again using Ajax (jquery)
> Should we program a mechanism that a functions does not execute on loading the page at first
It will always execute on loading the page at first only
If you want to execute Harbour code later on, then you need to call the server again using Ajax (jquery)