Iframe and Ajax question

Discussion and feedback on Construct 2

Post » Wed Oct 10, 2012 1:58 am

Hi all,

Quick question, if I have an app with an iframed app both with an ajax command will it screw each command up or will it just take longer to process?

What I'm thinking of doing is splitting my game up into the main window or the control window and and iframe. When the user clicks on the map command it pulls up the map subapp. Or the chat subapp. But I'm curious how the ajax would handle it if I did that. the subapp would pull the userid from the iframe urlbar and start its own processing. The main app would be ajaxing mysql for vital stats while the map would be ajaxing the map info.

Would I be getting errors with that or just slower response times?

Thanks,

Lance
B
69
S
21
G
15
Posts: 701
Reputation: 15,629

Post » Wed Oct 10, 2012 9:55 am

It sounds like it ought to work fine, as long as both frames are on the same domain. It should be equally fast as if one page made all the AJAX requests.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,610

Post » Wed Oct 10, 2012 12:22 pm

@ashley, sweet so it sounds like that ought to work fine. I wanted to modulize my game. I figured it would cut the complexity out of the game as I'm trying to make and rpg. Guess the side benefit is that I can make multiple ajax calls. :)
B
69
S
21
G
15
Posts: 701
Reputation: 15,629

Post » Wed Oct 10, 2012 1:16 pm

@Ashley
Ajax question. How do I use the data field in the post ajax expression? I can't find any documentation on it. I'm guessing it's easier than adding all the parameters into the address field but I'm not sure how to fill it in. If I want to post to http://example.com//example.php with parameters foo=1 and bar=2 How do I fill it in using both the address bar and data field below?
B
69
S
21
G
15
Posts: 701
Reputation: 15,629

Post » Wed Oct 10, 2012 1:44 pm

@lanceal: the address would be "http://example.com//example.php", and the post data would be "foo=1&bar=2" (the same format you'd use in a URL).
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,610

Post » Wed Oct 10, 2012 6:17 pm

@Ashley,

Ok, thanks. So I don't need to put the ? in the url?
B
69
S
21
G
15
Posts: 701
Reputation: 15,629


Return to Construct 2 General

Who is online

Users browsing this forum: BBaller1337 and 19 guests