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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:22:20+00:00 2026-05-22T12:22:20+00:00

I downloaded some code and in it was the following fragment: function GetCommentBySessionIDWCF_JSON() {

  • 0

I downloaded some code and in it was the following fragment:

 function GetCommentBySessionIDWCF_JSON() {
            varType = "POST";
            varUrl = "service/CommentSessionIDWCFService.svc/GetCommentsByPost";
            varData = '{"SessionID": "' + '123' + '"}';
            varContentType = "application/json; charset=utf-8";
            varDataType = "json";
            varProcessData = true;

            //now to do the clever stuff
            $.ajax({
                type: varType, //GET or POST or PUT or DELETE verb
                url: varUrl, // Location of the service
                data: varData, //Data sent to server
                contentType: varContentType, // content type sent to server
                dataType: varDataType, //Expected data format from server
                processdata: varProcessData, //True or False
                success: function (data) {//On Successfull service call

                    $.each(data.GetCommentsByPostResult, function (e) {
                        alert(e.CommentText);
                    });

                },
                error: ServiceFailed// When Service call fails
            });

What im wondering is why I have to send JSON with this post? I read the jQuery documentation and it says:

“Data to be sent to the server. It is converted to a query string, if not already a string. It’s appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of the traditional setting (described below).”

But when I changed the JSON in ‘data’ to a string I get a 400 error. why?

  • 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-22T12:22:21+00:00Added an answer on May 22, 2026 at 12:22 pm

    It’s not JSON, it’s an object containing key/value pairs that is rendered to HTTP ?param=value to be sent to the server.

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

Sidebar

Related Questions

A friend of mine downloaded some malware from Facebook, and I'm curious to see
have downloaded Orca to edit an MSI file. I want to remove some banner
Here's an interesting puzzle. I downloaded Snippet Compiler to try some stuff out, and
I'm trying to compile some downloaded source which contains lots of: 142 #ifdef __cplusplus
I have download the code for OpenFileDialog (File Upload function) from Silverlight tutorials website.
We have an application that downloads some files in the background. Our application pops
I want my web application users to download some data as an Excel file.
My computer at home is set up to automatically download some stuff from RSS
I'm about to be forced to write a script to download some number of
We have a C# application that connects to a FTP server, downloads some files,

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.