javascript - 错误 : Object #<Object> has no method 'toUpperCase'

标签 javascript ajax jquery

我目前收到错误 Object #<Object> has no method 'toUpperCase'在发出 POST 请求之前,非常感谢您的帮助!谢谢

function ajaxeo(url, data, method){
    $.ajax({
        url: url,
        type: method,
        data: data,
        success: function(response){
            alert(response);
        }
    });
}

function cambio(ID, newValue){
ajaxeo("includes/php/ajax/changeProvider.php?oldID="+ID, "post", {"newVal": newValue});
}

var editable = $('div[contentEditable][dataAjax]');
for (var i=0, len = editable.length; i<len; i++){
    editable[i].setAttribute('data-orig',editable[i].innerHTML);
    editable[i].onblur = function(){
        if (this.innerHTML == $(this).attr('data-orig')) {
            // no change
        }
        else {
            // change has happened, store new value
            $(this).attr('data-orig', $(this).html())
            cambio($(this).attr('dataId'), $(this).html());
        }
    };
}

最佳答案

你传错了参数

ajaxeo("includes/php/ajax/changeProvider.php?oldID="+ID, "post", {"newVal": newValue});

应该是

ajaxeo("includes/php/ajax/changeProvider.php?oldID="+ID, {"newVal": newValue}, "post");

错误可能是 jQuery 试图确保方法是大写的

关于javascript - 错误 : Object #<Object> has no method 'toUpperCase' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14169001/

相关文章:

javascript - 向 knockout 映射添加额外的对象属性

javascript - Chart.js 条形图中的多个条形宽度

jquery - 使用 jQuery 加载 HTML 片段

php - 将新字段附加到现有数组

java - 将Json数据填充到动态生成的表中

javascript - Ajax 成功消息不起作用

python - 有没有办法可以在 ajax 调用的成功函数中下载文件?

javascript - 如何在 v3 Google map 上以特定纬度和经度绘制 HTML 元素?

javascript - 单击按钮时阻止 Javascript 事件

javascript - 是否可以调用将值返回给 javascript 的 Objective-C 函数?