Before one of my users realize an action, I need to know how many credits they have to see if they can do the action or not.
I do this using an ajax call, something like this:
jQuery.ajax({url: 'getCredit.php',
type: 'POST',
})
.done(function( data) {
if (data.credit >= 1) { do the action }
});
My question is: Can't my users "cheat" changing the var (data.credit) to be always >1 with chrome console, or firebug?
What's the best way to ask for their credit?
EDIT: I have a form, and I want to check the credit when they click the submit button, so the form won't send if they have not enough credit to do it. I think this clarify it a bit.
Thanks.