How to create a JSON WebService in c# ASP.Net with a valid JSON output and query with JQuery/Ajax

How to create a JSON WebService in c# ASP.Net with a valid JSON output and query with JQuery/Ajax

Content Index :

How to create a JSON WebService in c# ASP.Net with a valid JSON output and query with JQuery/Ajax
Tag : chash , By : ciops
Date : November 25 2020, 07:06 PM

No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Jquery Ajax Posting json to webservice

Tag : jquery , By : ciops
Date : March 29 2020, 07:55 AM
I hope this helps . You mentioned using json2.js to stringify your data, but the POSTed data appears to be URLEncoded JSON You may have already seen it, but this post about the invalid JSON primitive covers why the JSON is being URLEncoded.
I'd advise against passing a raw, manually-serialized JSON string into your method. ASP.NET is going to automatically JSON deserialize the request's POST data, so if you're manually serializing and sending a JSON string to ASP.NET, you'll actually end up having to JSON serialize your JSON serialized string.
var markers = [{ "position": "128.3657142857143", "markerPosition": "7" },
               { "position": "235.1944023323615", "markerPosition": "19" },
               { "position": "42.5978231292517", "markerPosition": "-3" }];

    type: "POST",
    url: "/webservices/PodcastService.asmx/CreateMarkers",
    // The key needs to match your method's input parameter (case-sensitive).
    data: JSON.stringify({ Markers: markers }),
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function(data){alert(data);},
    failure: function(errMsg) {
public class Marker
  public decimal position { get; set; }
  public int markerPosition { get; set; }

public string CreateMarkers(List<Marker> Markers)
  return "Received " + Markers.Count + " markers.";

How do you output a query from a .cfm page using jQuery AJAX in JSON format?

Tag : jquery , By : Morbo
Date : March 29 2020, 07:55 AM
This might help you I am trying to output a query from a .cfm page using jquery with json format. Can someone tell me what I am dong wrong? , ./test.cfm:
<table id="results" cellspacing="0" cellpadding="0">
    $("#runQuery").click(function () {


            type: "GET",
            url: "./test.cfm",
            dataType: "json",
            success: function (resp, textStatus, jqXHR) {
            error: function (jqXHR, textStatus, errorThrown)


    function buildResultsTable(resp)
        var tmp_html = $("<tr />");
        var j = 0;


            for (var i = 0; i < resp["COLUMNS"].length; i++)
                var tmp_th = $("<th />");   

            for (j = 0; j < resp["DATA"].length; j++)
                tmp_html = $("<tr />");

                for (var i = 0; i < resp["DATA"][j].length; i++)
                    var tmp_td = $("<td />");   


jQuery $.ajax error: Parsing JSON Request failed with valid JSON?

Tag : jquery , By : geo
Date : March 29 2020, 07:55 AM
wish helps you why you have '?callback=?' at the end of url ? is it jsonp? yes then change the dataType:'jsonp'
    url: 'localhost:39657/List/' + $(this).val(),
    dataType: "json",
    success: function(json) {
var resp = new HttpResponseMessage();

ASP.NET webservice wish ajax, json, jquery and vb.net

Tag : asp.net , By : user112141
Date : March 29 2020, 07:55 AM
it should still fix some issue The reason for this is no matter how you specify the content-type of your ajax call, ASP.NET sends the request with Content-Type text/xml
A solution to this problem is available at: http://bloggingabout.net/blogs/adelkhalil/archive/2009/08/14/cross-domain-jsonp-with-jquery-call-step-by-step-guide.aspx

jquery ajax json parseerror valid json data

Tag : javascript , By : jamerson
Date : March 29 2020, 07:55 AM
hop of those help? application/json this solve it cant believe i waste 2 hours because of this line. the ajax doesnt cause the error..its in the servlet.
this is the line
Related Posts Related QUESTIONS :
  • How to convert API Json response to C# Array?
  • Blazor Textfield Oninput User Typing Delay
  • Performing both layout and render transform results in wrong output
  • uwp beforetextchanged cursor moving in front of text
  • How to keep duplicates from a string[] exclude words from a List and print them out
  • .Net Core Strings.Asc/Mid/Chr/Len missing even after importing Microsoft.VisualBasic
  • How to return to previous search page without being asked to Confirm Form Re-submission and keeping the results on ASP.N
  • How set a identity scaffolding item/page how initial page in asp.net MVC core?
  • LINQ isn't calling Dispose on my IEnumerator when using Union and Select, expected behavior or bug?
  • What is "ByteArray.uncompress()" in AS3 equivalent to in C#?
  • Getting a specific letter from a string variable for my simple guessing game for clues
  • Send an email with Outlook without a subject --- dialog box issue
  • passing List<MyModel> from my controller in the "WebInterfaceProject" to the processor method in "D
  • How to convert Word document created from template by OpenXML into MemoryStream?
  • How can I make a single slider that changes the color of an object?
  • Remap JSON parameter in c#
  • What is the difference between "this ref" and "ref this" when talking about C# 7.2 ref extension met
  • Convert OpenSSL encryption into native C#
  • Accessing Properties in Razor Pages
  • How to get SOAP element value
  • Projection after Group
  • C# error cannot convert sytem.text.regularexpressions.match to string
  • Issues with Save/Load System in a Text Based Adventure game made with ScriptableObjects in Unity
  • VS2019 MSBuild.exe - ASP .Net MVC project fails to publish when using PublishProfile, but works when using OutDir parame
  • Does <pages validateRequest="false" /> in Web.config still matter?
  • How to send new request to redirect URL with new access token
  • Attempt to invoke virtual method on a null object reference Xamarin LockScreen
  • "The attribute names could not be inferred from bind attribute 'bind-value'" exception in Blazor
  • How to fix ''System.ArgumentException" in c#?
  • C#. Ref returning delegate for ref extension method
  • Swashbuckle Swagger generate an actual guid
  • Trying to make thousands of database calls simultaneously - they stack instead of running concurently
  • run mstest from cmd using testcontainer
  • How to make M:N (many-to-many) relationship where both M and N are the same entities?
  • Consume COM DLL from multiple clients
  • Convert json string response representing UCHAR array to Byte array
  • Why does this LinqPad program produce different results on the second run?
  • ServiceStack how to use MaxLoginAttempts feature
  • What does "late-bound access to the destination object" mean?
  • How to load appsettings.json inside a Static class based on deploy environment so that I can use in other class librarie
  • dynamically add images to view
  • Are static extension methods on User object safe?
  • Process thousands of database calls simultaneously
  • Trying to decrypt a string with public key(not private) using bouncycastle in .net
  • How to retrieve the name of an usb device
  • Query many-to-many related data using Entity Framework Core
  • ASP.NET MVC : how to find the view from a controller?
  • Inconsistent behaviour using Entity Framework for ASP.NET MVC app vs windows service
  • AutoFixture Customize vs Build
  • How to change textbox location at the click of a mouse in live mode?
  • How can I deserialize a XML file without defining the parent node?
  • asp.net core how decrease class coupling
  • ASP.NET Core Razor Pages Routing With parameters
  • String Escaping With $ Interpolation and @ Encoding
  • ConfigurationManager in ASP.NET WebAPI tested with HttpServer
  • Top down shooting in Unity 2D don't work as I want it to
  • Use own redirectUri when the Authentication expires
  • Using "foreach" in string array c#
  • "Object reference not set to an instance of an object" for create multiply models on one view
  • Get data passed trought pushAsync
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com