在ASP Classic中从Ajax中检索POST数据

时间:2014-11-12 21:14:48

标签: jquery ajax asp-classic

我试图简单地用ajax / jquery发布值并在ASP classic中打印出来。

当我检查开发者工具中的网络选项卡时,它将delete_id和tbl显示为已发布的值,但它们不会显示在我的代码中。

<script>
$(document).ready(function(){
 $('input#del-policy').click(function(){
    var element = $(this);
    var del_id = element.attr("name");
    var info = "delete_id=" + del_id + "&tbl=policies";
    if(confirm("Are you sure you want to delete this entry?"))
    {
     $.ajax({
       type: "POST",
       url: "admin.asp",
       data: info,
       success: function(){
         }
       });

       $(this).parent().parent().fadeOut("slow", function() {
         $(this).remove();
       });
     }
    return false;
  });
 });
</script>

<%
dim i
i = Request.Form("tbl")
Response.Write(i)
%>

1 个答案:

答案 0 :(得分:0)

试试这个:

$(document).ready(function(){
 $('input#del-policy').click(function(){
 var element = $(this);
 var del_id = element.attr("name");
 var info = "delete_id=" + del_id + "&tbl=policies";
if(confirm("Are you sure you want to delete this entry?"))
{
 $.ajax({
   type: "POST",
   url: "admin.asp",
   data: info,
   success: function(response){
      $("#yourControlid").val(response); //This do the trick
   }
   });

   $(this).parent().parent().fadeOut("slow", function() {
     $(this).remove();
   });
 }
 return false;
 });
 });

Asumming这是admin.asp

<%
  i = Request("tbl")
  Response.Write(i)
%>