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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:52:53+00:00 2026-05-25T14:52:53+00:00

I am designing a Restful web service for an internal corporate application, and am

  • 0

I am designing a Restful web service for an internal corporate application, and am curious how to merge JSON and “web content” requests.

The web application, like all good corporate applications, has a three-letter abbreviation that is reflected in the URL. Let’s say that this application’s “call sign” is abc, and the users access it at the following URL

http://servername/abc

When the users access the root of the application we want to serve them up the main html page, the .js files (including jquery), the css, and the images. Then, jquery will start to make AJAX calls back to the server.

What is the best way to handle these multiple content types?

http://servername/abc (returns contents of index.html)

http://servername/abc/javascript/jquery.js (returns a js file)

http://servername/abc/countries/de (returns JSON)

Should I split this into two web contexts? Should I use the jquery contentType parameter in the ajax calls to explicitly specify JSON versus HTML versus something else?

  • 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-25T14:52:54+00:00Added an answer on May 25, 2026 at 2:52 pm

    the jQuery contentType is really just a parameter that sets your content-type header on your HTTP request to the server. It is always a best practice to set these for your AJAX calls.

    Added:
    Another good practice is to specifiy the dataType parameter as that will set the accept header on your HTTP request. This is useful for both GET and POST AJAX requests.

    Most, if not all, web service frameworks (Rails, ASP.NET MVC, .NET WCF, etc..) have abilities to examine the headers of an HTTP request and determine what type of content to serve back

    for example:
    application/json in an HTTP Header would let your webservice know to return a JSON response instead of an HTML or XML response.

    Some of the better ways that I have seen web apps organized for HTML/JSON serving is to make your standard routes always serve your HTML pages and resources, ie:

    http://servername/abc

    http://servername/abc/javascript/jquery.js

    would do exactly as you have said. For your JSON (or even XML) responses, I see folks create a route that is explicity understood to serve back those types of responses, ie:

    http://servername/api/abc/countries/de

    the url route begins with an /api/ which would always be understood to serve back a non-html JSON/XML response

    this makes it pretty easy for your company to internally and externally understand that /api/ routes are your JSON/XML responses. It also makes it easier to expose these methods to your customers externally should you want to do that as the infrastructure is there, you would just need to authenticate, etc… the requests.

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

Sidebar

Related Questions

I'm designing a RESTful Service Oriented Architecture web application to make it scale as
We're in the early stages of designing a RESTful/resource-oriented web service API for a
I'm designing a RESTful web service utilizing ROA(Resource oriented architecture). I'm trying to work
I am desiging a RESTful Web Service (JBoss + RESTeasy). The UI programmer is
A Guide to Designing and Building RESTful Web Services with WCF 3.5 , this
I am designing RESTful Api's and would like some advice on designing an API
I am designing a restful HTTP API for my application. The app has Categories
I am designing a RESTful API and I would like to know what the
I am designing a RESTful API for a booking application and was quite happy
I'm currently designing an architecture for a web-based application that should also provide some

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.