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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:51:12+00:00 2026-05-15T14:51:12+00:00

ScriptSharp 0.6 turns C# to Javascript and looks pretty neat. However I don’t have

  • 0

ScriptSharp 0.6 turns C# to Javascript and looks pretty neat. However I don’t have much experience with event handling in C# and I’m stuck on how to do this:

$.post("urlToPostTo", $("#testform").Serialize(),
   function(data){
     alert(data.name); // Something sent from the server
   }, "json");

That’s a simple JQuery form post that returns an alert with the JSON return object as the success callback. For ScriptSharp it is setup like:

public static XmlHttpRequest Post(string url, object data, AjaxCallback callback);

With AjaxCallback defined as:

public delegate void AjaxCallback(object data);

It seems like I’d set something up along these lines:

JQuery.Post("urlToPostTo", JQuery.Select("#testform"), callbackhere);

I’m at a loss as to how to setup and define the callback in C#, any ideas?

  • 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-15T14:51:13+00:00Added an answer on May 15, 2026 at 2:51 pm

    Your code would be something like this:

    JQuery.Post("url", JQuery.Select("#testform").Serialize(),
        delegate(object data) {
            Script.Alert(Type.GetField(data, "name"));
        });
    

    Basically an anonymous delegate in c# gets translated to a function suitable for use as a callback. You can also write it as a regular method, and use a delegate to that method.

    Hope that helps.

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

Sidebar

Related Questions

We have determined it's too difficult for us to maintain the bulk of javascript
Im using ScriptSharp to create a RIA app. Works nice besides some oddities. However
As I have just learnt the Script# that I don't know how to use
I'm using the fantastic project Script# ( http://projects.nikhilk.net/ScriptSharp ) I can't seem to get
According to the Script# website (http://projects.nikhilk.net/ScriptSharp), You can also use Visual C# Express. I've
I have a page that uses a TreeView control from ComponentArt. If I add
How can I reproduce this in ScriptSharp (C#): myObject = function(input) { } myObject.prototype
In Javascript I can access the page's stylesheet information with the following command Example:
I am in the process of choosing ScriptSharp for coding all my javascripts. I
I've just come across a pretty strange problem with VS2010 and Script#, which most

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.