如何从javascript连接到方法? [英] How to connect to method from javascript?

查看:65
本文介绍了如何从javascript连接到方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的方法。我想把这个方法调用到javascript,怎么做。



任何人都可以帮帮我???



This is my method .i want to call this method to javascript,how to do it.

any one can help me???

public static DataSet getCitycode(string Citycode )
{

   string sql = "SELECT  Citycode  FROM tblCityDetails WHERE Citycode  ='"+ Citycode +"'";
   DataSet Sector = SQLTrans.executeQuery(sql);
   return Sector;
}

推荐答案

你不能。并不是说它只是不可能,整个想法根本没有意义。这不是事情的运作方式。这个方法在服务器端执行,JavaScript在客户端执行。



你需要学习HTTP,Web,.NET的基础知识,然后才学习ASP。净。你显然还没有得到它。不用担心,你会学到它:

http://www.asp.net/get-started [ ^ ]。



-SA
You cannot. Not that it''s just impossible, the whole idea simply makes no sense. This is not how things work. This methods is executed on server side, and JavaScript — on client side.

You need to learn the basics of HTTP, Web, .NET, and only then ASP.NET. You apparently did not get it yet. Not to worry, you will learn it:
http://www.asp.net/get-started[^].

—SA


如果您的方法在代码隐藏文件中意味着aspx.cs文件,那么您可以使用jQuery调用该方法喜欢

If your method is in code behind file means aspx.cs file then you can call that method using jQuery like


(document).ready(function(){
(document).ready(function () {


这篇关于如何从javascript连接到方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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