0

How to do JSON call into JavaScript script

Hi,

I need some help with my code. I'm trying to do a JSON call into Javascript script. This is a pieces of code:

var choice =ask("Digit 1 or 2 ", {voice:"Giulia",choices:"[1 DIGITS]",mode:"dtmf",timeout:40.0});

function processResponse(data)

{

say("test test", {voice:"Giulia"});

obj=JSON.parse(data);

var pippo=obj.Data;

}

if (choice.value == '1')

{

say("test", {voice:"Giulia"});

requestNumber = JSONRequest.post

("extranet.xxxxxxxxxxxxxxxxxx/GetTrancheAmount",

     {  "salesInObj": {"CountryCode": "IT","ContractType": "GBB"}},

function (requestNumber, value, exception)

{

if (value) {

processResponse(value);

}

else {

processError(exception);}

}

);

say("questo e' il valore di data " + pippo.value, {voice:"Giulia"});

}

My code run successfully up to requestNumber = JSONRequest.post..... . How I can do successfully do a JSON call and parse its results?

Thanks in advance.

Cristian.

3 comments

Please sign in to leave a comment.