从后面的C#ASP.NET code调用jQuery函数 [英] Call jQuery function from ASP.NET code behind C#

查看:114
本文介绍了从后面的C#ASP.NET code调用jQuery函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下jQuery函数

I have the following jquery function

> <script type="text/javascript">
> 
>     $(document).ready(function() {
> 
>         $('#callGrowel').click(function() {
>             $.growlUI('Email Received', 'from Joe Bloggs');
>         });
>     });
> 
> </script>

在我的aspx页面我有一个div

and in my aspx page I have a div

<div id="callGrowel" >Run Growe l</div>

但我需要从我的code调用growlUI jQuery函数隐藏文件在C#中,而不是点击UI中的一个div的方式。

but I need a way of calling the growlUI jquery function from my code behind file in C# rather than clicking on a div in the UI.

这是可能的?

推荐答案

这是没有道理真的。你的C#code中的服务器上运行,以产生被传递给客户端,并翻译有一个HTML文件。 jQuery的只能上的HTML n中的客户端操作

This doesn't make sense really. Your C# code runs on the server to generate an HTML file which is passed to the client and translated there. jQuery can only operate on the HTML n the client side.

时你要不要更换成就

     $('#callGrowel').click(function() {
         $.growlUI('Email Received', 'from Joe Bloggs');
     });

     $.growlUI('Email Received', 'from Joe Bloggs');

这篇关于从后面的C#ASP.NET code调用jQuery函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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