Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6001183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:47:56+00:00 2026-05-23T00:47:56+00:00

I am building a phonegap application that interfaces with a web service I’ve set

  • 0

I am building a phonegap application that interfaces with a web service I’ve set up. Having a strange problem that I cannot explain. The same exact code works properly on Android but fails on iPhone. It’s just jQuery.

Here is the code:

$.ajax({
    url: app_domain + '/sessions',
    type: 'POST',
    dataType: 'json',
    data: {
        session: {
            email: u_email,
            password: u_password 
        },
        mobile: '1' },
    async: true,
    cache: false,
    success: function(data){

        // do cool stuff here

    },
    error: function(){

        // complain here                

    }
})

And here is the part I cannot figure out. When I look in my server logs to try and figure out what is going wrong with this POST request i see the following for android:

...
Processing by SessionsController#create as JSON
...[SUCCESS]

and for the iPhone request:

...
Processing by SessionsController#create as HTML
...[FAIL]

The difference being JSON (correctly) for POST originating from Android device and HTML (incorrect) for POST originating from iPhone4.

What gives? Any ideas? Thanks!

p.s. this was originally written as a jquery $.post() function and it had the same outcome. I rewrote it as $.ajax() for the increased specificity…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:47:57+00:00Added an answer on May 23, 2026 at 12:47 am

    You probably need to modify the outgoing HTTP headers to indicate that you are in fact sending JSON. Add headers to your ajax map:

    headers: {'Content-Type': 'application/json'}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building an Android application that's based around an enhanced WebView (based on PhoneGap).
Im building Phonegap application that uses token authentication strategy to access rest services. Is
I am building a small app using PhoneGap HTML/CSS. Now my problem is that
Building an application with a database that has the ability to get big not
I read that PhoneGap is approved by Apple as a framework for building native
I'm building a phonegap application for my blackberry. When I have the application open
I'm building a hybrid mobile application (PhoneGap+JQM). While testing in the Android emulator, I'm
We are building a PhoneGap app (both for iOS and Android) that has a
Building a test web service and all was working great, so I added the
So we already have a web service that was develop a long time ago.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.