错误:对象#<object>没有方法'toUpperCase'</object>

时间:2013-01-05 05:38:32

标签: javascript ajax jquery

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

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());
        }
    };
}

1 个答案:

答案 0 :(得分:1)

您传递的参数错误

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

应该是

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

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