奇怪的是,我找不到这个问题的答案,但是,我收到了这个错误:
TypeError: 'undefined' is not a function (evaluating 'i.replace(et,"<$1></$2>")')
它似乎来自这行代码(我不得不煞费苦心地注释每一行代码才能找到它):
$.post("include/ajax.php", {updateWorkArt:"1", title:title, height:height, width:width, medium:medium, type:type, id:id, left:fin, top:top}, function(data){},"json");
这是完整的代码:
$(document).on("click", "#updateWorkPopup", function(){
var title = $("#updateWorkTitle").val();
var height = $("#updateWorkHeight").val();
var width = $("#updateWorkWidth").val();
var medium = $("#updateWorkMedium").val();
var type = $("#updateWorkAssetType").val();
var id = $("#whiteBgPopup").attr("data-workid");
if($.trim(title) != "" && $.trim(height) != "" && $.trim(width) != "" && $.trim(medium) != "" && $.trim(type) != "")
{
var left = parseInt($("#offsetContainer").position().left);
var containerMid = parseInt($(window).width()/2);
var fin = (-containerMid+left)*-1;
var top = parseInt($("#wall").height()/2);
$.post("include/ajax.php", {updateWorkArt:"1", title:title, height:height, width:width, medium:medium, type:type, id:id, left:fin, top:top}, function(data){
if(data.success)
{
$("#popUp").fadeOut("slow", function(){
$("#popUp").find("input").each(function(){
$(this).val("").blur();
});
$("#wall").append("<div class='adjustArtwork' data-workid='" + id + "' style='left:" + fin + "px; top:" + top + "px;' ><img src='" + data.image + "' width='" + data.width + "' /></div>", function(){
alert("finished");
});
});
}
alert("yes!");
},"json");
}
});
这个错误到底是什么意思?