用JavaScript调用服务器端功能 [英] Call server side function in javascript

查看:101
本文介绍了用JavaScript调用服务器端功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


如何在javascript中调用服务器端函数而无任何回发.有可能吗?

谢谢

Hi,
How to call server side function in javascript without any postback.Is it possible?

Thanks

推荐答案

请参考以下主题:
http://forums.asp.net/t/1355672.aspx/1 [ ^ ]
http://www.aspsnippets.com/Articles/从ASP.Net.aspx中的JavaScript调用服务器端功能- [
Please refer following threads:
http://forums.asp.net/t/1355672.aspx/1[^]
http://www.aspsnippets.com/Articles/Calling-server-side-function-from-JavaScript-in-ASP.Net.aspx[^]


您可以尝试以下操作:

You try this:

How to call Server Side function from Client Side Code using PageMethods in ASP.NET AJAX[^]

hope it helps :)


必须有某种形式的回发到服务器才能触发活动.您最感兴趣的两个HTTP动词是POST和GET.甚至使用AJAX之类的技术也使用这些技术与Web服务器进行通讯.

您是否有机会避免执行ASP.NET回发操作?如果是这样,则可以使用AJAX与服务器端方法进行通信.我在我的文章
A的Whistle-stop Tour中演示了使用AJAX的客户端. jQuery [ ^ ](有关详情,请查看标有它不仅仅支持荷兰足球"的部分).我没有在这里回答服务器端,因为我不知道服务器端堆栈是什么技术(即纯ASP.NET还是MVC).
There has to be some form of posting back to the server in order to trigger an activity. The two HTTP verbs of most interest to you here are POST and GET. Even techniques such as using AJAX use these to communicate back with the web server.

By any chance, are you referring to avoiding having to perform an ASP.NET postback operation? If you are, then you can use AJAX to communicate with the server side method. I demonstrate the client side of using AJAX in my article, A Whistle-stop Tour of jQuery[^] (look for the section marked "It doesn''t just support Dutch football" for details). I haven''t covered the server side in my answer here because I have no idea what technology your server side stack is (i.e. is it plain ASP.NET or MVC).


这篇关于用JavaScript调用服务器端功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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