Date:  08/05/2018 02:42:30 PM Msg ID:  004959
From:  Olatunji Beckley Thread:  004957
Subject:  Re: Access foxweb\'s JSON sting in Javascript
The foxweb script below already stores the json string to the variable SchargeJSON.
 
(Sample Foxweb  Script):
 
SELECT * FROM SON5200 INTO CURSOR crScharge ORDER BY Servcode
IF _TALLY > 0
    SchargeJSON = fwJSON.WriteCursor()
ENDIF
 
In the same foxweb script, i have a form with a select input type with the onchange event attribute that calls a javascript function "servLookup1()". See the script below.
 
<select id="servcode1" name="servcode1" onchange="servLookup1()"> 
 
The problem is that i need to reference the foxweb variable "SchargeJSON" in the javascript.
 
Sent by Jeff Grippe on 08/01/2018 08:46:16 PM:
Hello,
 
I think you need to use Response.Write(fwJSON.WriteCursor()) so that the FWX will return json instead of a page. Then all you have to do is to write an ajax/ http request.
 
 
users={}
$http.get('\getusers.fwx').then(function(resp){
users =resp.data;
});
 
Sent by Olatunji Beckley on 07/27/2018 04:02:09 PM:
Hi All,
 
This is really not a foxweb issue, but need someone to help or suggest a solution.
 
I would like to access a json string generated with fwJSON.WriteCursor() as a JSON object in javascript function.  
 
E.g. (Sample Foxweb  Script):
 
SELECT * FROM SON5200 INTO CURSOR crScharge ORDER BY Servcode
IF _TALLY > 0
    SchargeJSON = fwJSON.WriteCursor()
ENDIF
 
Is there a way to reference the SchargeJSON variable/object in a javascript function?
 
TIA