Using the tutorial given here, I am making an app to fetch json data from a URL and display it. I am using this code to call the URL and parse.
{
xtype: 'nestedlist',
title: 'Blog',
iconCls: 'star',
cls: 'blog',
displayField: 'title',
store: {
type: 'tree',
fields: ['uuid', 'display'
],
root: {
leaf: false
},
proxy: {
type: 'scripttag',
url: 'http://localhost:8081/openmrs-standalone/ws/rest/v1/location',
reader: {
type: 'json',
rootProperty: 'results'
}
},
},
},
In the console i am getting response in the form
{
"results": [
{
"uuid": "c0937f0c-1691-11df-97a5-7038c432aabf",
"display": "Chulaimbo",
"links": [
{
"uri": "http://localhost:8081/openmrs-standalone/ws/rest/v1/location/c0937f0c-1691-11df-97a5-7038c432aabf",
"rel": "self"
}
]
},
{
"uuid": "c0937d4f-1691-11df-97a5-7038c432aabf",
"display": "Mosoriot Hospital",
"links": [
{
"uri": "http://localhost:8081/openmrs-standalone/ws/rest/v1/location/c0937d4f-1691-11df-97a5-7038c432aabf",
"rel": "self"
}
]
},
{
"uuid": "8d6c993e-c2cc-11de-8d13-0010c6dffd0f",
"display": "Unknown Location",
"links": [
{
"uri": "http://localhost:8081/openmrs-standalone/ws/rest/v1/location/8d6c993e-c2cc-11de-8d13-0010c6dffd0f",
"rel": "self"
}
]
}
]
}
but its showing an error "location" is the name of the service.
I have done it using a different method. I used proxytype 'rest' and run OpenMRS and my application on the same server and port otherwse my instance of OpenMRS wont allow cross-domain calls. The problem in this question was using type as "scripttag" which i still dont know what is the problem with it.Using "rest" resolves it.