如何使用Ajax

时间:2018-11-09 17:08:07

标签: javascript asp.net ajax vb.net html5

我想使用ajax运行vb函数。 这是运行ajax查询的功能。

 function runajax() {

            $.ajax({
                url: '*.aspx/prueba',
                contentType: "application/json; charset=utf-8",
                cache: false,
                await: true,
                beforeSend: function () {
                    $('#loading').show();
                },
                error: function (message) {
                    alert("ERROR")
                },
                complete: function () {
                    $('#loading').hide(); alert("COMPLETE");
                }
            });
            return false;
       }

在* .aspx.vb内部的函数上,我有这个:

<WebMethod()>
  Public Function prueba() as string
  Dim hola as string = "hola"
Label2.Text = "IT WORKS"
ScriptManager.RegisterStartupScript(Me,Page.GetType(),"pop","openModal();",true
  Return hola
End Function

我想做的是在函数运行时显示一个加载div,然后该函数调用模式。

0 个答案:

没有答案