Have look at the javascript API documentation to get an idea on how to achieve this.
https://apidocs.rnd.mendix.com/9/client/mx.data.html
I think mx.data.get would be able to help you out.