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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:05:52+00:00 2026-06-09T05:05:52+00:00

Question: I have the below JavaScript handler for jQuery sortable. The problem is i

  • 0

Question:

I have the below JavaScript handler for jQuery sortable.
The problem is i get an error (parseerror).
The problem is datatype: JSON + contentType: ‘application/json’ seem to be required that the data gets sent properly.

However, I don’t want the response to have to be in JSON format.
I want a text/plain response on a application/json request.

Is that not possible ?
Or: How do I do that properly (without having to give a JSON response) ?

Http-Handler:

Imports System.Web
Imports System.Web.Services

Public Class FMS_SaveTeaserSort
    Implements System.Web.IHttpHandler

    Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest

        Dim strpagesget As String = context.Request.QueryString("pages")
        Dim strPagesPost As String = context.Request.Form("pages")

        Dim json As String = Nothing
        Using sr As New System.IO.StreamReader(context.Request.InputStream)
            json = sr.ReadToEnd()
        End Using ' sr

        json = context.Server.UrlDecode(json)
        'Dim customer As Byte() = New Byte(System.Convert.ToInt32(context.Request.InputStream.Length) - 1) {}
        'context.Request.InputStream.Read(customer, 0, customer.Length)
        'Dim customerJSON As String = System.Text.Encoding.UTF8.GetString(customer)
        ' TODO: deserialize the JSON back to a Customer object


        context.Response.ContentType = "text/plain"
        context.Response.Write("Hello World!")

    End Sub


    ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
        Get
            Return False
        End Get
    End Property


End Class

JavaScript code:

$(function () {
    //$('#sortable').sortable();


    $('#sortable').sortable({
        update: function (event, ui) {
            var strMovedElementId = ui.item.attr('id');
            //alert("post");
            $.ajax({
                url: './ajax/FMS_SaveTeaserSort.ashx'
                        , type: 'POST'
                        , cache: false
                        //, contentType: 'application/json'
                        //, contentType: 'text/plain'
                        //, contentType: "application/x-www-form-urlencoded" 
                        , contentType: "application/json; charset=utf-8"
                        , dataType: "json"
                        //, data: JSON.stringify({ pages: $(this).sortable('toArray') })
                        , data: { pages: $(this).sortable('toArray') }
                        , success: function (result) {
                            //alert("success");
                        }


                        , error: function (request, type, errorThrown) {
                            var message = "There was an error with the AJAX request.\n";
                            //alert(type);

                            switch (type) {
                                case 'timeout':
                                    message += "The request timed out.";
                                    break;
                                case 'notmodified':
                                    message += "The request was not modified but was not retrieved from the cache.";
                                    break;
                                case 'parsererror':
                                    message += "Parser error: Bad XML/JSON format.";
                                    break;
                                default:
                                    message += "HTTP Error (" + request.status + " " + request.statusText + ").";
                            }
                            message += "\n";
                            alert(message);


                            switch (request.status) {
                                case 400:
                                    alert('HTTP ' + request.status + ': ' + request.statusText + '\nThe request cannot be fulfilled due to bad syntax');
                                    break;
                                case 401:
                                    alert('HTTP ' + request.status + ': ' + request.statusText + '\nAuthentication is possible but has failed or not yet been provided');
                                    break;
                                case 403:
                                    alert('HTTP ' + request.status + ': ' + request.statusText + '\nAccess denied');
                                    break;
                                case 404:
                                    alert('HTTP ' + request.status + ': ' + request.statusText + '\nThe requested page could not be found but may be available again in the future');
                                    break;
                                case 405:
                                    alert('HTTP ' + request.status + ': ' + request.statusText + '\nA request was made of a page using a request method not supported by that page');
                                    break;
                                case 408:
                                    alert('HTTP ' + request.status + ': ' + request.statusText + '\nThe server timed out waiting for the request');
                                    break;
                                case 410:
                                    alert('HTTP ' + request.status + ': ' + request.statusText + '\nThe requested page is no longer available');
                                    break;
                                case 500:
                                    alert('HTTP ' + request.status + ': ' + request.statusText + '\nA generic error message, given when no more specific message is suitable\nError description:\n' + request.responseText);
                                    break;
                                case 502:
                                    alert('HTTP ' + request.status + ': ' + request.statusText + '\nThe server was acting as a gateway or proxy and received an invalid response from the upstream server (fastcgi-crash?)');
                                    break;
                                case 503:
                                    alert('HTTP ' + request.status + ': ' + request.statusText + '\nThe server is currently unavailable (overloaded or down)');
                                    break;
                                case 504:
                                    alert('HTTP ' + request.status + ': ' + request.statusText + '\nThe server was acting as a gateway or proxy and did not receive a timely response from the upstream server');
                                    break;
                                case 511:
                                    alert('HTTP ' + request.status + ': ' + request.statusText + '\nThe client needs to authenticate to gain network access');
                                    break;
                                case 0:
                                    alert('HTTP ' + request.status + ': ' + request.statusText + '\nRequest aborted');
                                    break;
                                default:
                                    alert('HTTP ' + request.status + ': ' + request.statusText + '\nUnknown error: \nError description:\n' + request.responseText);
                            } // End Switch

                        }


                        , complete: function (result) {
                            //alert("complete");
                        }

            }); // End ajax
        } // End Update
    }); // End Sortable


    $('#sortable').disableSelection()
});
  • 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-06-09T05:05:55+00:00Added an answer on June 9, 2026 at 5:05 am

    Change the dataType from json to text

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

Sidebar

Related Questions

I have a beginner level Json question with MVC.net (I've never really used jquery
Question: The JavaScript code below: records is JSON serialized data. I can access it
I have a question understanding some JavaScript syntax, below: var myObject = { value:
This might be a confusing question but I have written below a Directory crawler,
I have a question, I have value as below which I set in an
I have a question which is described below: What problems would arise for testing
I have a figure below: And my question is that the objects in Array
I have a question, here are two classes below: class Base{ public: virtual void
I have a question about stored procedures in Oracle. Below is the stored procedure
I have been given the below .NET question in an interview. I don’t know

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.