iOS, PHP, and C2

Discussion and feedback on Construct 2

Post » Thu Jun 07, 2012 5:40 pm

Yesterday I set up a simple php script on my website to retrieve data from a database based on the name input in a simple C2 project. The php uses $_REQUEST so it can take info from either get or post.

The c2 project is completely simple. 1 textbox 1 button 1 text object 1 AJAX object. Type in the textbox click the button it requests the php page. On AJAX complete it sets the text objects text to the LastData. On AJAX error it does the same thing.

Cant really get any more simple than that

On desktop browsers this works perfectly. I can get the correct values from typin the url mself and from the c2 project.

On my iphone with mobile safari I can get the correct values if I type the url mself but _NOT_ from the c2 project.

The c2 project always gives the AJAX error event with _NO_ LastData!

So you can see my question here... How come c2 always gives me an error even tho my php clearly works fine when I enter the url manually? And why is it only on my iphone that its happening?

EDIT: forgot to mention I also tried the ajaxPOST plugin found in the plugins section. The result is the same as the standard c2 ajax pluginaridale2012-06-07 17:42:24
B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Thu Jun 07, 2012 7:46 pm

Are you making a cross-domain request? Some browsers don't support that, and mobile browsers tend to be behind desktop browsers.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,554

Post » Thu Jun 07, 2012 8:00 pm

nope not cross domain at all I already fought that battle lol. Unless iphone is doin some crazy stuff I dunno about
B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Mon Jun 11, 2012 6:27 pm

Sooo any word or input on this?
B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Mon Jun 11, 2012 8:30 pm

I don't know, it sounds like it might be a problem with Safari or your server setup. Have you tried enabling developer mode for Safari and checking if it reports any errors?
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,554

Post » Mon Jun 11, 2012 8:49 pm

@Ashley nope I hadnt tried that didnt know I could. I just did though and got an xmlhttprequest cannot load the page. That was a cross domain issue. Tried again accessing the secure page directly and it worked.

No idea why now itd work and it wouldnt last week. I didnt touch it since I posted this thread initially... /shrugaridale2012-06-11 20:56:54
B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Tue Jun 12, 2012 5:55 pm

I've been plugging away with php for a bit now with facebook and sql using the ajax post plugin. Had one issue with the data not returning properly(It worked fine for me typing in the php script from the address bar but it wasn't registering the return data.) . Once I checked the echo statement (problem was with the echo) and fixed the issue it worked fine. My guess is ask someone on stackoverflow to check your php script for those goofball mistakes like I had made.
B
68
S
21
G
15
Posts: 701
Reputation: 15,604


Return to Construct 2 General

Who is online

Users browsing this forum: Andres941, tayxd, TheRealDannyyy and 11 guests