ajax
  • jquery
  • post
  • asp-classic
  • 2012-03-03 21 views 1 likes 
    1

    我正在嘗試使用jquery ajax json獲取我從一個頁面發送到另一個頁面的值。ajax後得到CLASSIC asp中的值html

    這是我的代碼:

    function checkTheVin() 
    { 
    $.ajax({ 
          type: "POST", 
          url: "checkVin.asp", 
          data: 'theVIN=' + $("#vwVin").val(), 
          cache: false, 
          dataType: "html", 
          beforeSend: function() {$.blockUI({ message: '<img src="img/ajax-loader.gif" />' });}, 
          complete: function(){$.unblockUI();}, 
          success: function(responseText){ 
           if (responseText.indexOf("GOOD") > -1) 
           { 
            $("#theContent").html(responseText.replace("GOOD","")); 
           }else{ 
            //alert(data); 
           }     
          }, 
          error: function(responseText){alert('err: ' + responseText);}, 
         }); 
    } 
    

    但是我從來沒有得到一個resonse回來。它是空的。

    這就是我如何使用傳統的ASP得到它:

    dim vwVin 
    
    vwVin = request.QueryString("theVIN") 
    

    我在做什麼不正確?

    大衛

    回答

    0

    嘗試在你的Ajax調用使用GET方法:

    $.ajax({ 
        type: "GET", 
        url: "checkVin.asp", 
        data: 'theVIN=' + $("#vwVin").val(), 
        cache: false, 
        dataType: "html", 
        beforeSend: function() {$.blockUI({ message: '<img src="img/ajax-loader.gif" />' });}, 
        complete: function(){$.unblockUI();}, 
        success: function(responseText){ 
         if (responseText.indexOf("GOOD") > -1) 
         { 
          $("#theContent").html(responseText.replace("GOOD","")); 
         }else{ 
          //alert(data); 
         }     
        }, 
        error: function(responseText){alert('err: ' + responseText);}, 
    }); 
    
    0

    你有三個選擇

    使用Request對象但不指定集合

    dim vwVin 
    vwVin = request("theVIN") 
    

    然後,Web服務器將爲您搜索請求集合,首先查詢字符串,然後是表單。

    2.如果你正在使用Ajax後

    $.ajax({ type: "POST", ... 
    
    dim vwVin 
    vwVin = Request.Form("theVIN") 
    

    指定,如果你正在使用的Request.QueryString集合指定Request.Form集合阿賈克斯GET

    $.ajax({ type: "GET", ... 
    
    dim vwVin 
    vwVin = Request.QueryString ("theVIN") 
    
    相關問題