如何从java脚本函数调用vb.net函数 [英] how to call vb.net function from java script function

查看:65
本文介绍了如何从java脚本函数调用vb.net函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从javascript函数调用vb.net函数

我做了这个

i want to call vb.net function from javascript function
i made this

<script type="text/javascript">
        function test(imgPath) {
            alert(imgPath);
            
            <%deleteImg(imgPath) %>
        };
    </script>





但我有错误





but i had error

Error   1   'imgPath' is not declared. It may be inaccessible due to its protection level.





任何帮助?



any help ?

推荐答案

在Web世界中,Javascript永远不会调用服务器端方法,因为它在浏览器下工作,在客户端,而ASP.NET只在服务器端工作。仅当发送HTML请求时,客户端才会调用服务器端脚本。因此,你需要发布一些东西。你可以使用Ajax(一种方法是使用jQuery。 ajax()):

http://en.wikipedia.org/wiki/Ajax_%28programming%29 [ ^ ],

http://api.jquery.com/jquery.ajax [ ^ ]。



-SA
In the Web world, Javascript never ever call server-side methods, as it works under the browser, on client side, and ASP.NET works on the server side only. Client side invokes server-side script only if an HTML request is sent. Therefore, you need to post something. You can do it using Ajax (and one way of doing it is using jQuery .ajax()):
http://en.wikipedia.org/wiki/Ajax_%28programming%29[^],
http://api.jquery.com/jquery.ajax[^].

—SA


这篇关于如何从java脚本函数调用vb.net函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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