【问题标题】:Classic asp and ajax经典的asp和ajax
【发布时间】:2015-03-27 11:32:38
【问题描述】:

我在将价值从 ajax 转换为 asp 时遇到问题。我有带有选择输入字段的表单,如果我选择一个选项(从选择选项中)。我想更改我的表单操作标记值。

$(document).ready(function() {
     $("#preLin").change(function(){
        if ($('#preLin option:selected').val() === "Test" ) {
              var actionTag = "printHosp.his";
             $.ajax({
                 type: "POST",
                 url: "http://local:8001/Default.his",
                 data: {actionTag: "test.asp"},
                 success: function(data) { 
                 alert(actionTag);}
             });    
});

ASP

dim actionTag
actionTag = Request.form("actionTag")

<form action="<%=actionTag%>" name="input" method="post" target="_blank">

            <select name="preLin" id="preLin">
                <optgroup >
                        <option value="Test"></option>
                        <option value=""></option>                                          
                 </optgroup>

    </form>

【问题讨论】:

  • 目前有什么问题?为什么要将数据发布到某个东西,而不是元素编辑。
  • 另外,你忘记了 在你的 asp 页面中。

标签: ajax post asp-classic


【解决方案1】:

有做你想做的最佳实践,但我建议你通过添加“ajax错误函数”来解决这个问题,然后分析responseText。

将您的 ajax 调用更改为:

      $.ajax({
          type: "POST",
          url: "http://eli.local:8001/priemimas/Default.his",
          data: {actionTag: "test.asp"},
          success: function(data) {alert(actionTag);},
          error: function(xhr) {alert(xhr.responseText);}
      });  

【讨论】:

    猜你喜欢
    • 2015-05-06
    • 2016-09-23
    • 1970-01-01
    • 1970-01-01
    • 2016-07-29
    • 2015-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多