Using AJAX to update data in a database

Get help using Construct 2

Post » Wed Nov 02, 2011 10:43 am

Hello everyone,

I made a MMO browser-based game SDK with C# & ASP.NET which primarily interacts with Adobe Flash. However, since my SDK is now almost six years old, it is time to update it, since when it was first released mobile phones were not the powerful pocket-computers we see today. So therefore, I want to drop Flash entirely and update my SDK to use HTML5 too more actively target mobile phone users. (Hell, the 'mobile versions of my games are basically just text at the moment!). Initially I was going to develop my own HTML5 back-end, but with Construct 2 progressing in such a way it would be much cheaper (And faster!) to integrate Construct 2 with my C# back-end and use C2 for my HTML5 needs.

However, I have a question regarding the AJAX object. When you pass a Request to a file, will the code behind of that file be processed? As an example, say I want to collect the strength of a unit from a database I would pass along something like this:
domain.com/gatherunitdata.aspx?unitid=17

So that page takes the unitid of 17, connects to a database and returns the data as page content for Construct 2 to then use in the application. Would this work, or would Construct 2 just go to gatherunitdata.aspx and find a blank page?

Thanks ^^
B
4
S
1
G
3
Posts: 10
Reputation: 1,159

Post » Wed Nov 02, 2011 2:14 pm

If you have correctly coded the aspx page, it should work.
You can check out the tutorial about AJAX (the example is given in PHP, but the logic from the server-side is the same, you just have to code it correctly in whatever language you want).
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Wed Nov 02, 2011 4:52 pm

The AJAX object is like requesting the page in your browser. So the code for the page runs and returns the page content like usual!
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Thu Nov 10, 2011 2:09 pm

I purchased a business license for future use and I will play around with it some more. Are there any plans to update the AJAX object? Such as adding AJAX POST or being able to more easily read the returned GET data?
B
4
S
1
G
3
Posts: 10
Reputation: 1,159

Post » Thu Nov 10, 2011 3:01 pm

Yeah, hopefully we'll add posting and XML posting in future, it's just we have a long todo list right now! Hopefully it has enough basic functionality for the time being.Ashley2011-11-10 15:01:32
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 21 guests