Javascript 单击链接按钮时显示模式

Javascript 单击链接按钮时显示模式,javascript,asp.net,modal-dialog,Javascript,Asp.net,Modal Dialog,$(document).on("click", "[id*=lnkView]", function () { $("#resultId").html($(".ResultId", $(this).closest("tr")).html()); **//$("#name").html($(".Name", $(this).closest("tr")).html()); //$("#description").html($(".Description

$(document).on("click", "[id*=lnkView]", function () {

    $("#resultId").html($(".ResultId", $(this).closest("tr")).html());
    **//$("#name").html($(".Name", $(this).closest("tr")).html());
                //$("#description").html($(".Description",$(this).closest("tr")).html());**

          $("#dialog").dialog({
              title: "Analyze Result",
              buttons: {
                        Ok: function () {
                            $(this).dialog('close');
                        }
              },
              modal: true
           });
           return false;
           });
</script>
这是我的剧本

$(document).on("click", "[id*=lnkView]", function () {

    $("#resultId").html($(".ResultId", $(this).closest("tr")).html());
    **//$("#name").html($(".Name", $(this).closest("tr")).html());
                //$("#description").html($(".Description",$(this).closest("tr")).html());**

          $("#dialog").dialog({
              title: "Analyze Result",
              buttons: {
                        Ok: function () {
                            $(this).dialog('close');
                        }
              },
              modal: true
           });
           return false;
           });
</script>
如何将其链接到数据库

$(document).on("click", "[id*=lnkView]", function () {

    $("#resultId").html($(".ResultId", $(this).closest("tr")).html());
    **//$("#name").html($(".Name", $(this).closest("tr")).html());
                //$("#description").html($(".Description",$(this).closest("tr")).html());**

          $("#dialog").dialog({
              title: "Analyze Result",
              buttons: {
                        Ok: function () {
                            $(this).dialog('close');
                        }
              },
              modal: true
           });
           return false;
           });
</script>

我对javascript完全陌生。

要将数据链接到数据库,您需要中间层,可以是ASP.NET Web API、ASP.NET MVC或任何其他可以返回Json的带MVC模式的PHP应用程序

$(document).on("click", "[id*=lnkView]", function () {

    $("#resultId").html($(".ResultId", $(this).closest("tr")).html());
    **//$("#name").html($(".Name", $(this).closest("tr")).html());
                //$("#description").html($(".Description",$(this).closest("tr")).html());**

          $("#dialog").dialog({
              title: "Analyze Result",
              buttons: {
                        Ok: function () {
                            $(this).dialog('close');
                        }
              },
              modal: true
           });
           return false;
           });
</script>
您可以利用JQuery$.ajax函数在Web应用程序中点击您的操作的URL,并简单地使用它

$(document).on("click", "[id*=lnkView]", function () {

    $("#resultId").html($(".ResultId", $(this).closest("tr")).html());
    **//$("#name").html($(".Name", $(this).closest("tr")).html());
                //$("#description").html($(".Description",$(this).closest("tr")).html());**

          $("#dialog").dialog({
              title: "Analyze Result",
              buttons: {
                        Ok: function () {
                            $(this).dialog('close');
                        }
              },
              modal: true
           });
           return false;
           });
</script>
以下是一些资源,您应该从以下内容开始:

$(document).on("click", "[id*=lnkView]", function () {

    $("#resultId").html($(".ResultId", $(this).closest("tr")).html());
    **//$("#name").html($(".Name", $(this).closest("tr")).html());
                //$("#description").html($(".Description",$(this).closest("tr")).html());**

          $("#dialog").dialog({
              title: "Analyze Result",
              buttons: {
                        Ok: function () {
                            $(this).dialog('close');
                        }
              },
              modal: true
           });
           return false;
           });
</script>

任何帮助都将不胜感激。实际上,我只需要一个模式,必须更新数据库中的信息。所有这些都是必需的,或者有一个更简单的方法?您不能直接从internet浏览器访问数据库。所以你的浏览器必须回击服务器端的应用程序,就像前面提到的,它与数据库链接,然后处理请求并更新数据库中的信息,然后发送响应。