Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Technology & Software 2 years ago
Posted on 16 Aug 2022, this text provides information on Technology & Software related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
I'm using thegamesdb.com 's API to get all gaming platforms and all games on each platform. At the moment, I start with a blank page, on document.ready, I do an AJAX call to the server to get all the platforms. Then I have to do another AJAX call for each platform to get a count of games on that platform (ex. PC has 2342 games, XBOX has 453 games, ...). The reason I'm doing this call too, is to provide the user a progress bar (0-100%) and to show the number of the game on the total games of the platform: /
So after these API calls, I should have a list of all the platforms which can be clicked to start another serverside call to do an api call for each game, to get the data of it. When a platform is clicked, the client sends a new call each time so that the server puts the game data in the database. Then we do the gamecounter++.
I've tried doing this with AJAX calls to the server:
$.getJSON($('#platformlist').data('url-getplatforms'), function (data) { self.platforms = $.map(data, function(p) { return new Platform(p); }); console.log(self.platforms); $.each(self.platforms, function () { console.log(this); $.getJSON($('#platformlist').data('url-getplatformgames'), { platformId: this.id }, function (platformgamesdata) { this.countGamesDone = 0; $.each(platformgamesdata, function() { this.games.push(new PlatformGame(this)); this.countGames++; }); }); }); });
But since this is async, this can not show the progress and just makes the browser load until all the games are in the database without any feedback. I could put the AJAX on async:false, but I've read that there are other ways of doing this, but no one says how to do it.
What are other options of doing this? I have no restrictions on what technologies to use. It's an ASP.NET MVC 5 application. I can use javascript, c#, signalr, jquery and any other javascript library if this can simplify this
Why can't you display a floating loading message?
loading
$('#bigFatLoadingMessage').show(); $.getJSON($('#platformlist').data('url-getplatforms'), function (data) { self.platforms = $.map(data, function(p) { return new Platform(p); }); $.each(self.platforms, function () { //update overlay message $('#bigFatLoadingMessage').html('Loading platform ' + this.name); $.getJSON($('#platformlist').data('url-getplatformgames'), { platformId: this.id }, function (platformgamesdata) { this.countGamesDone = 0; $.each(platformgamesdata, function() { this.games.push(new PlatformGame(this)); this.countGames++; }); }); }); $('#bigFatLoadingMessage').hide(); });
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 10 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 9 Answers
General Tech 2 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.