通过调用一个JavaScript服务器端功能服务器端、功能、JavaScript

2023-09-03 08:00:12 作者:温暖如初

我需要调用当一个项目被挑中的ASP下拉框中选择一个服务器端的功能, 是否有人可以告诉我该怎么做?

I need to invoke a server side function when an item is picked in an ASP drop-down box, Can someone please tell me how to do that?

推荐答案

在ASP.NET中使用下拉选择指数的变化情况。或者对客户端的事件,你可以使用jQuery,然后使用下面的JavaScript函数连接到服务器:

Within ASP.NET use the drop down selected index change event. Alternatively for a client side event you could use JQuery and then use the following JavaScript function to contact the Server:

function CallServer() {
    $.ajax({
        url: 'webserviceURL',
        type: "POST",
        datatype: "json",
        success: function (result) {
            if (result.Success) {

            } else {

            }
        }
    });
}