In my current project, I am using a Dajaxice view to check if a specific item is already present in the shopping cart before adding a new one. In my field of work, certain items have prerequisites that need to be met, making it challenging to process multiple items with the same requirements. If this explanation seems confusing, it's not crucial for understanding the issue at hand.
After the Dajaxice view completes its validation, it returns a value indicating whether everything was successful (1) or not (0). The JavaScript function responsible for handling this data is shown below:
function mta_limit(data) {
if (data.good == 1) {
document.forms['shopping_cart'].submit();
} else {
alert("Sorry! Only one of those items per order.");
}
}
The main problem I am facing is that anyone with some computer knowledge can easily bypass the AJAX check by inspecting the code and manipulating their order as they wish.
I have tried using HttpResponseRedirect within Dajaxice to submit the form without success. Is there any other way to achieve this functionality? Any guidance on this matter would be greatly appreciated. Thank you!