Aggiornamento per il nostro Diamond servizio e che andremo a costruire la propria app per Android o iOS
Self, AIML, and scripting

How to call plain text with a json request

da marcosnunes postato Feb 28 2017, 18:38

 

How to make this script call the json webservice and return a plain text?

 

 

function Teaching() {

var text = Http.requestJSON("https://teacherbot.000webhostapp.com/wp-json/wp/v2/pages?slug=" + Http.encode(star[1]);); return JSON.stringify(json[0].content.rendered); } }


}


by admin posted Feb 28 2017, 20:11
I think the code you want is something like:
// Returns WordPress posts. state TeachEnglish { pattern "^ [verbo pronome pronomes] (to) *" answer Teaching(); function Teaching() { var text = Http.requestJSON("https://teacherbot.000webhostapp.com/wp-json/wp/v2/pages?slug=" + Http.encode(star[1])); text = json[0].content.rendered; text = text.replace("<p>", ""); text = text.replace("<\/p>", ""); text = text.replace("\n", ""); text = text.trim(); return text; } }


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 1848, today: 1, week: 1, month: 7

Id: 15620372
Postato: Feb 28 2017, 18:38
Risposte: 1
Vista: 1950, oggi: 1, settimana: 2, mese: 6
0 0 0.0/5