iOS, PHP, and C2

  • 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 plugin

  • Are you making a cross-domain request? Some browsers don't support that, and mobile browsers tend to be behind desktop browsers.

  • nope not cross domain at all I already fought that battle lol. Unless iphone is doin some crazy stuff I dunno about

  • Sooo any word or input on this?

  • 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?

  • 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... /shrug

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)