Hello,
We are using below code in our app.js file:
function renderContactName() {
var textElement = document.getElementById('apptext');
client.data.get('contact')
.then(function getData(data) {
var getContact = client.request.post("https://example.com/index.php?route=test/test", {
body: JSON.stringify({
id: data.contact.id,
})
});
getContact.then(showContact).catch(handleErr);
function showContact(payload) {
var response = JSON.parse(payload.response);
var html = '<b>' + response.contact.name + '</b>' + '<i>' + response.contact.id + '</i>';
textElement.innerHTML = html;
}
})
.catch(errorHandler);
}
The code was working earlier bit now it is calling our URL without id. So our questions are:
- Why id is not sent in request?
- We are not receiving the response?
- How to handle html response?
- How to handle json response with nested array?
Any help will be appriciated.
Thanks!