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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:13:59+00:00 2026-05-25T02:13:59+00:00

I am working on a C# console application using the Nancy Framework and the

  • 0

I am working on a C# console application using the Nancy Framework and the Spark view engine, and I am trying to replicate something from another project. However, I am very inexperienced with both Javascript and JSON. To call a chat function in my C# code from my HTML, right now I simply use something like the following…

HTML:

http://localhost:1234/sendchat?message="this is a test message"

C# Code:

    Get["/sendchat"] = x =>
    {
        string message = Request.Query.message;
        string message2 = message.Replace("\"", "");
        Console.WriteLine(message2);

        return View["console.spark"];
    };

The problem is that this causes the page to reload. In the project I am looking at for reference, they use Javascript/JSON to call the same type of function without doing a page reload. I understand all of it except for the JSON line as I don’t understand what the DataSource is…

$(document).ready(function () {
    $("#typechat").keypress(function (event) {
        if (event.keyCode == '13') {
            event.preventDefault();
            message = escape($("#typechat").attr('value'));
            $.getJSON(dataSource + "?req=sendchat&message=" + message);
            $("#typechat").attr('value', "");
        }
    });
});
  • 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-25T02:13:59+00:00Added an answer on May 25, 2026 at 2:13 am

    dataSource is just an http domain like http://yourserver.com/possibly/with/a/path. It’ll be a string defined somewhere in the code.

    JSON resources are fetched just like regular HTML pages, with a normal GET request over HTTP. The only difference is the content is JSON not HTML. Try this in your browser for example to see the JSON returned by the SO api:

    http://api.stackoverflow.com/1.1/users/183579

    (If you don’t have a browser plugin to format/highlight JSON nicely it might just look like a long messy string)

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

Sidebar

Related Questions

Working on a console application using Delphi 7, and have run into a problem.
I am working on a console application to insert data to a MS SQL
The following code is working great in a normal console application: private void button1_Click(object
I have a console project that I have been working on. I added log4net
When working with a console application, a history of everything that has been entered
I am working on .NET Framework 3.5 using C# in Windows XP as administrator
I'm trying to build a simple form in a c++ win32 console application. instead
I'm using .NET 3.5 and WCF for developing a server-client application. Binding=BasicHttp. I'm working
Right now, I have a console application I'm working on, which is supposed to
I am working on a windows application using c# . I want to retrieve

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.