Calling AJAX to database using java script

0
Hi, How do call an ajax to a database using java script to get the suggestions for a textbox(particular attribute) in mendix.
asked
2 answers
3

Hi Laxman,

You can not (and should not) communicate directly with your database from javascript (how would you securely store the DB password??). Instead all communication should go via the mendix runtime server.

If you want a textbox with suggestions you should take a look at the Auto Complete widget https://appstore.home.mendix.com/link/app/2695/ . We use it and it works really nice, might help you with your requirement.

-Andrej

answered
2

Hi Laxman, 

What you are looking to do could be achieved in a couple of ways within the Mendix client side api: https://apidocs.mendix.com/7/client/

within the API you can use mx.data https://apidocs.mendix.com/7/client/mx.data.html

in order to GET an object from the database for example, or you could use action in order to call a microflow. 

these are generally the normal ways of performing retrieves via a javascript widget within mendix. 

 

hope this helps.

answered