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

  • Home
  • SEARCH
  • 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 3307038
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:21:34+00:00 2026-05-17T21:21:34+00:00

I am using the local database in web kit browsers and to get the

  • 0

I am using the local database in web kit browsers and to get the data from the database I have the following code:

function synchronise() {
        myDB.transaction(
        function (transaction) {
            transaction.executeSql("SELECT * FROM Patients;", [], synchroniseHandler, errorHandler);
    }
);

With I am trying to do now with the synchroniseHandler is to send all the rows to a web service and process the data there.

function synchroniseHandler(transaction, results) {
    for (var i = 0; i < results.rows.length; i++) {
        var row = results.rows.item(i);
        var patient = new Object();

        patient.name = row['name']
    patient.address = row['address']
        patient.city = row['city']
    patient.state = row['state']
        patient.zip = row['zip']
    patient.phone = row['phone']

        $.ajax({
            type: "POST",
            url: "MyService.asmx/synchronise",
            data: JSON.stringify(patient),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
        success: function (msg) {
                alert("success");
            },
            error: function (xhr, status) {
                alert("fail" + status);
            }
        });
    }
}

However it always fails saying “error”

It’s an ASP.NET 2.0 webb application but I am using JSON.NET and my webmethod to get the data is

[WebMethod]
        public void synchronise(string patient)
        {
        JObject o = JObject.Parse(patient);
                string name = (string)o["name"];
              string address = (string)o["address"];
        string city = (string)o["city"];
                string state = (string)o["state"];
                string zip = (string)o["zip"];
                string phone = (string)o["phone"];

As it is now I am not using ajax but have JavaScript function that gets all rows and then insert them in a remote database when I click a button and it works. However, I am tryint to insert these automatically without a postback.

Any suggestions on how I can get this to work?

EDIT:
Seems like the error comes from the web service:

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

System.InvalidOperationException: Request format is invalid: application/json; charset=UTF-8.

   at System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()

   at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()

edit2…
added support for httppost in web.config and got rid of
Failed to load resource: the server responded with a status of 500 (Internal Server Error)

  • 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-17T21:21:34+00:00Added an answer on May 17, 2026 at 9:21 pm

    Your web service method is expecting a string as a parameter. You are passing in a complex type. Define a matching type on the server and use it as the parameter type. You shouldn’t need to create a object from the JSON string as you are.

    Removed dangerous link here

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

Sidebar

Related Questions

I have been using anonymous namespaces to store local data and functions and wanted
Can any data exchanged on a local machine using the loopback IP 127.0.0.1 (localhost)
So i have this local SVN repo that i am using for my dev
I am using the ReportViewer control from Visual Studio 2008 in Local Mode with
I am using git for windows to manage a local project. I have two
I have just learned how to use the SQLite database for local storage in
I'm writing an ASP.NET web service using C# that has a DoLookup() function. For
I'm writing a web application that constantly retrieves XML components from a database and
Using (local) in the connection string doesn't work on my cluster. I'm assuming it's
I'm using local shared objects within flash both to store significant amounts of user

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.