【问题标题】:Call Function to another class调用函数到另一个类
【发布时间】:2018-02-16 13:33:04
【问题描述】:

我在将变量传递到另一个文件时遇到问题,我已经实现了代码但我没有找到解决方案,它在函数中向我发送错误

onclick="limit();javascript:AyudaTipos(2)"/>

功能

function limit (){


 $.ajax({
            url: 'Tipos.php',
            type: 'POST', // GET or POST
             data: {"acreedor":$("#acreedor").val(),"importe2":$("#importe2").val(),
            success: function(data) { // data is the response from your php script
                // This function is called if your AJAX query was successful
              alert(data);
            },
            error: function() {
                // This callback is called if your AJAX query has failed
                alert("Error! Funcion Limite Anual");
            }
             }
        });
        }

【问题讨论】:

  • 你的 PHP 函数是什么样的?您收到的错误是什么?
  • im recived alert error error: function() { // 如果您的 AJAX 查询失败,则调用此回调 alert("Error!Funcion Limite Anual"); }
  • 您在控制台上看到什么了吗?这通常是查找问题所在的好地方。
  • 你似乎没有正确结束你的 data 对象
  • 错误是(未定义)

标签: javascript php html mysql ajax


【解决方案1】:

已解决:

$(function(){


$('#help').click(function(){





    $.ajax({
        url: 'Tipos.php',
        type: 'POST', // GET or POST
         data: {"acreedor":$("#acreedor").val(),"importe2":$("#importe2").val()},
        success: function(data) { // data is the response from your php script
            // This function is called if your AJAX query was successful
          alert(data);
        },
        error: function() {
            // This callback is called if your AJAX query has failed
            alert("Error!nuevo");
        }
    });
});

});

谢谢

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-06
    • 1970-01-01
    • 2018-07-30
    相关资源
    最近更新 更多