为什么我在jQuery 1.4.4.min文件中收到意外的令牌错误?

为什么我收到此错误:

Uncaught SyntaxError: Unexpected token < cbextend.globalEval jquery-1.4.4.min.js:32 c.extend.httpData jquery-1.4.4.min.js:144 c.extend.ajax.Lwonreadystatechange jquery-1.4.4.min.js:140 

这个错误并没有指向我的JS中触发此问题的位置。 只是jQuery min文件。

我该如何调试并修复它?

Edit1:这是我的调用堆栈围绕此错误的一些屏幕截图。 但仍然不确定,哪个文件具有jQuery调用的语法错误。

在此处输入图像描述在此处输入图像描述在此处输入图像描述

编辑2:

以下是我的一些AJAX调用:

 $('form#project-ajax-form').submit(function(){ if(compv.steps.selectedClient.id != null){ $('input#project_client_id').val(compv.steps.selectedClient.id); console.debug("Project Client Value: " + $('input#project_client_id').val()); return true; } console.debug("Project Client Value not found"); compv.tools.clientError(); return false; }); $('#project-ajax-form') .bind("ajax:success", function(evt, data, status, xhr){ compv.updateStepView('project', xhr); }); $('#client-ajax-form') .bind("ajax:success", function(evt, data, status, xhr){ console.log("Calling Step View"); compv.updateStepView('client', xhr); }); $('form#stage-ajax-form').submit(function(){ if(compv.steps.selectedProject.id != null){ $('input#stage_project_id').val(compv.steps.selectedProject.id); console.debug("Stage Project Value: " + $('input#stage_project_id').val()); return true; } console.debug("Stage Project Value not found"); compv.tools.clientError(); return false; }); $('#stage-ajax-form') .bind("ajax:success", function(evt, data, status, xhr){ compv.updateStepView('stage', xhr); }); $.ajaxSetup({ beforeSend: function(xhr) { xhr.setRequestHeader("Accept", "text/javascript"); } }); $('.ajax-form') .bind("ajax:success", function(evt, data, status, xhr){ var $form = $(this); console.log("Form Success: %s", $(this).attr('id')); // Reset fields and any validation errors, so form can be used again, but leave hidden_field values intact. $form.find('textarea,input[type="text"],input[type="file"]').val(""); $form.find('div.validation-error').empty(); }) .bind("ajax:failure", function(evt, xhr, status, error){ var $form = $(this), errors, errorText; console.log("Form Failure: %s", $(this).attr('id')); try { // Populate errorText with the comment errors errors = $.parseJSON(xhr.responseText); } catch(err) { // If the responseText is not valid JSON (like if a 500 exception was thrown), populate errors with a generic error message. console.error("Server Error for Form: %s", $(this).attr('id')); errors = {"Server Error": "Please reload the page and try again"}; } // Build an unordered list from the list of errors errorText = "There were errors: \n
    "; for ( error in errors ) { errorText += "
  • " + error + ': ' + errors[error] + "
  • "; } errorText += "
"; // Insert error list into form var errorDiv = $form.find("div.validation-error"); errorDiv.html(errorText); errorDiv.show(300); });

callstack表明jQuery正在从对AJAX请求的响应中调用eval

您正在为具有语法错误的Javascript文件调用getScript


要回答您提出的问题,您可以通过切换到jQuery(不是.min )的调试版本并使用调试器(如Firebug或Chrome的开发人员工具)来调试此问题。

在另一个问题中回答了这个问题: Uncaught SyntaxError:意外的令牌 – jQuery – 帮助!