In my current scenario, I am dealing with multiple banner ads on a page and I need to track how many times each one is displayed. For example, let's consider banners with IDs 1, 2, 3, 4, and 5.
Every time the page refreshes, banners with IDs 1, 2, and 3 are loaded. To save these IDs in the database for view count, I need to extract this information and pass it to the controller.
My query revolves around utilizing jQuery AJAX to retrieve the ID numbers and sending them to the controller. Currently, I have defined the following JavaScript variable:
var adId = '1,2,3';
While I could iterate through ajax calls for each ID separately, I prefer a more efficient solution. Is there a way, perhaps using JSON or another method, to fetch this data and utilize it in the controller every time the page loads?