Calling a server side function using a javascript

前端 未结 4 2015
暖寄归人
暖寄归人 2021-01-25 22:20

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?

4条回答
  •  孤城傲影
    2021-01-25 23:08

    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 {
    
                }
            }
        });
    }
    

提交回复
热议问题