Make call to Database collection with jQuery.ajax

Problem:

You may want to update certain items in DB with jqm ajax or even pure javascript without services.
Sometimes you have a need to update entity with custom ajax call.

Solution:

Use this small snippet bellow:

Don’t forget to define:
dbId – your database Id
entityId – entity you want to update(if entity with such Id doesn’t exists you will get “400 Bad request”)
MY_COLLETCION_NAME – collection that has entity you are trying to update
UPDATING_PARAM – collumn you want to update in that entity. In my case it has type “Number”

Leave a Reply

Your email address will not be published. Required fields are marked *