从C#传递数据的jQuery [英] Passing data from C# to jQuery

查看:110
本文介绍了从C#传递数据的jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

寻求一些建议,如何最好地处理以下的情况下,我是唯一的程序员。

我目前正在开发一个C#的WinForms应用程序,我写的新功能,允许用户创建Processing.js草图进行数据分析的目的。我建立了一个Processing.js IDE(工作),它允许用户编写和测试Processing.js草图和HTML code。

最后一块拼图是从数据库到草图公开数据。

什么是我应该调查,以达致这是最好的方法?

数据驻留在Firebird数据库和访问/使用NHibernate的操作。数据访问是用C#,从数据库中被用于整个应用程序的数据访问层返回对象的方法。理想情况下,我想访问这些数据创建处理草图的目的。

该Processing.js IDE还包括jQuery库。这怎么可能使用jQuery检索数据库中的数据。我可以调用位于数据访问层在C#的方法。

任何意见是AP preciated。

解决方案
  1. 您将需要一个REST服务,您会从UI使用调用 jQuery的。

  2. 您的REST服务将返回一个JSON的结果,否则,     将会使事情变得更加复杂。

  3. 在用户界面,你会打电话使用$阿贾克斯()函数的Web服务。

    一旦你得到了服务回报您的结果,你可以操纵 在JavaScript中的数据并显示它

Seeking some advice how to best handle the following situation, I am a sole-programmer.

I am currently developing a C# Winforms application, new functionality that I am writing allows a user to create Processing.js sketches for data analysis purposes. I have built a Processing.js IDE (working) which allows the user to write and test Processing.js sketches and HTML code.

The final piece of the puzzle is to expose data from the database to the sketches.

What is the best approach I should investigate to acheive this?

Data resides in a Firebird database and is accessed/manipulated using NHibernate. Data access is written in C#, methods in the data access layer return objects from the database that are used throughout the application. Ideally I would like to access this data for the purposes of creating Processing sketches.

The Processing.js IDE also includes the jQuery library. How is it possible to retrieve database data using jQuery. Can I call the C# methods located in the data access layer.

Any advice is appreciated.

解决方案

  1. you will need a REST service, which you will call from UI using jQuery.

  2. your REST service will have to return a JSON result , otherwise it will make things more complicated.

  3. in UI you will call the webservice using $.ajax() function.

    once you got your results back from service , you can manipulate data in javascript and display it

这篇关于从C#传递数据的jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆