Hello,
I have a get request and live server shows an error. I also did a console.log of json received from the API.
{“first”:{“id”:1,”product_name”:”Doorbell”,”cost”:199},”second”:{“id”:2,”product_name”:”Bottle”,”cost”:99},”third”:{“id”:3,”product_name”:”Washing Machine”,”cost”:7999}}
file:/BasicApp/qml/pages/ListadosAlbaranesPage.qml:86: Unable to assign QString to QVariantList.
This is my code:
HttpRequest.get(url)
.timeout(5000)
.end(function(err, resp) {
var content = resp.text
if(resp.ok) {
console.log(resp.status);
console.debug(content)
jsonData = resp.body
}
else {
console.log("error de datos")
console.log(err.message)
console.log(err.response)
}
})
JsonListModel {
id: listModel
source: searchPage.jsonData
}
AppListView {
id: listView
anchors.fill: parent
// the model specifies the data for the list view
model: listModel
// the delegate is the template item for each entry of the list
delegate: SimpleRow {
text:model.product_name
}
}
Any help?
thank you