简体   繁体   English

在Javascript中使用vb.net代码

[英]Using vb.net code in Javascript

usually when I programming a web application with java I use DWR library to enables Java on the server and JavaScript in a browser to interact and call each other. 通常,当我使用Java编程Web应用程序时,我使用DWR库来启用服务器上的Java和浏览器中的JavaScript进行交互和相互调用。

for example, I can call a java routine to access the DB directly from a javascript code, and this is really useful. 例如,我可以调用Java例程从javascript代码直接访问数据库,这确实很有用。

Now I'm trying to create a web application with visual studio 2012 and I don't know if I can do the same thing with asp.net. 现在,我正在尝试使用Visual Studio 2012创建一个Web应用程序,但我不知道我是否可以使用asp.net做同样的事情。

I've tried some "googling" but i don't had success. 我尝试了一些“搜索”,但没有成功。 Someone can help me? 有人可以帮我吗?

Thanks and sorry for my bad english >.< 谢谢,抱歉我的英语不好。

You can access the server side code by using javaScript. 您可以使用javaScript访问服务器端代码。
There are some good links on this site . 这个站点上有一些很好的链接。

Based on my experience, i found this web service to be a very useful tool. 根据我的经验,我发现此Web服务是一个非常有用的工具。

1. You must have a web service or asmx . 1.您必须具有Web服务或asmx (check how to create here ). 在此处检查如何创建)。
2. Use jQuery or other method of Ajax POST to communicate with the web service. 2.使用jQuery或Ajax POST的其他方法与Web服务通信。

$.ajax({
    url: "/location_of_your_webservice/ASMX_FILE.asmx/backend_method_or_function",
    ...


Or if you just have to fire a button click that triggers the backend event then you might want to check this . 或者,如果您只需要触发触发后端事件的按钮单击,那么您可能需要检查一下

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM