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 4094608
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:45:59+00:00 2026-05-20T19:45:59+00:00

I have a data Store that gets it’s information from a JSON api on

  • 0

I have a data Store that gets it’s information from a JSON api on my server. When I run the code in WebKit/Chrome everything appears to work fine, but if I change my user-agent to iPhone 4.1, etc it appears that the JSON requests aren’t getting set properly. Instead of sending a request to get JSON it simply sends the request and gets the HTML rendered page instead.

This is the Store that I have defined:

Product.ProductStore = new Ext.data.Store({
    model: 'Product',
    proxy: {
        type: 'ajax',
        url: '/admin/products.json',
        reader: {
            type: 'json',
            root: 'products'
        }
    },
    autoLoad: true,
    storeId: 'productStore',
    getGroupString: function(record){
        return record.get('vendor')[0];
    }
});

So what I really want to have this store do is send a request to /admin/products.json, which works as expected on the desktop. But when I run this in my Simulator or even on a Device it appears to be just sending the request to /admin/products which returns the HTML instead.

Some people have suggested that this is a rails server issue and I need to set the content type for my request. The problem is how do I exactly do this?

I’ve tried the following, and it doesn’t appear to work either:

Product.ProductStore = new Ext.data.Store({
    model: 'Product',
    proxy: {
        type: 'ajax',
        url: '/admin/products.json',
            // Trying to set the headers for the request -- not working
        headers: {
            'Content-Type': 'application/json'
        },
        reader: {
            type: 'json',
            root: 'products'
        }
    },
    autoLoad: true,
    storeId: 'productStore',
    getGroupString: function(record){
        return record.get('vendor')[0];
    }
});

Could I simply replace the AJAX request with my own that has the content-type headers set properly? If so, are there some examples which use a store and it’s own custom AJAX request?

  • 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-20T19:45:59+00:00Added an answer on May 20, 2026 at 7:45 pm

    It should be

    'Accept' : 'application/json'
    

    Accept is a header the client uses to tell the server what media-type it prefers.
    Content-Type is a header that the server sends as part of the response telling the client what the data is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The Problem We have a large web application that stores and displays sensitive HIPAA-related
I have a huge table, which has 3 columns and about 333,000 rows. The
Well, I have a new project, and I've not done anything like it before,
Our company has 4 business entities, so I have created 4 different databases for
As best I can tell when a worker process recycles: a) a new one
This is a question I had about working with the Kohana framework, though I
I see several questions relating somewhat to this, but I still can't find the
I've written a large social networking iPhone application, and one of the biggest issues
I'm am designing my database/domain for an eCommerce application and I'm having a hard
I'm using CodeIgniter's Session class to manage my sessions for a cart/checkout system. The

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.