FOSJSRoutingBundle Symfony2 =>未捕获的SyntaxError:意外的标记<

时间:2016-11-09 00:40:25

标签: symfony

我在生产时遇到此错误

routing?callback=fos.Router.setData:1 Uncaught SyntaxError: Unexpected token <

此处出现类似行为,但我正在使用apache。

https://github.com/FriendsOfSymfony/FOSJsRoutingBundle/issues/34

我无法理解这个问题所以不确定要显示的其他代码。

这是我加入的方式

  <script src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script>
  <script src="{{ path('fos_js_routing_js', {'callback': 'fos.Router.setData'}) }}"></script>

这就是我使用它的方式

Routing.generate('lead_by_any', { slug : slug , single: 1});

修改:1

fos.Router.setData({"base_url":"\/demo\/web\/app_dev.php","routes":{"crm_mobile_tasks":{"tokens":[["text","\/m\/tasks"]],"defaults":[],"requirements":[],"hosttokens":[]},"crm_mobile_tasks_upcoming":{"tokens":[["text","\/m\/tasks\/upcoming"]],"defaults":[],"requirements":[],"hosttokens":[]},"crm_mobile_missed":{"tokens":[["text","}"],["variable","","[^\/]+","id"],["text","\/m\/missed\/{"]],"defaults":[],"requirements":[],"hosttokens":[]},"crm_mobile_marketing_leads":{"tokens":[["text","\/m\/leads\/marketing"]],"defaults":[],"requirements":[],"hosttokens":[]},"lead_by_mobile":{"tokens":[["variable","\/","[^\/]++","slug"],["text","\/m\/mobile"]],"defaults":{"slug":null},"requirements":[],"hosttokens":[]},"property_show":{"tokens":[["text","\/show"],["variable","\/","[^\/]++","id"],["text","\/inventory\/property"]],"defaults":[],"requirements":[],"hosttokens":[]},"property_sell":{"tokens":[["variable","\/","[^\/]++","isSell"],["variable","\/","[^\/]++","property"],["text","\/inventory\/property\/sell"]],"defaults":[],"requirements":[],"hosttokens":[]},"property_edit":{"tokens":[["text","\/edit"],["variable","\/","[^\/]++","id"],["text","\/inventory\/property"]],"defaults":[],"requirements":[],"hosttokens":[]},"property_email":{"tokens":[["text","\/inventory\/property\/sendmail"]],"defaults":[],"requirements":[],"hosttokens":[]},"property_images":{"tokens":[["variable","\/","[^\/]++","id"],["text","\/inventory\/property\/images"]],"defaults":[],"requirements":[],"hosttokens":[]},"property_images_remove":{"tokens":[["variable","\/","[^\/]++","id"],["text","\/inventory\/property\/images\/remove"]],"defaults":[],"requirements":[],"hosttokens":[]},"property_images_pdf":{"tokens":[["variable","\/","[^\/]++","id"],["text","\/inventory\/property\/images\/pdf"]],"defaults":[],"requirements":[],"hosttokens":[]},"inventory_sold_ajax":{"tokens":[["text","\/inventory\/sold_ajax"]],"defaults":[],"requirements":[],"hosttokens":[]},"inventory_rename_location_ajax":{"tokens":[["variable","\/","[^\/]++","name"],["variable","\/","[^\/]++","location"],["text","\/inventory\/rename_location"]],"defaults":[],"requirements":[],"hosttokens":[]},"propertyreservation_approve":{"tokens":[["variable","\/","[^\/]++","time"],["variable","\/","[^\/]++","date"],["variable","\/","[^\/]++","id"],["text","\/propertyreservation\/propertyreservations\/approve"]],"defaults":[],"requirements":{"_method":"GET"},"hosttokens":[]},"complaint_close":{"tokens":[["variable","\/","[^\/]++","id"],["text","\/complaint\/close"]],"defaults":[],"requirements":[],"hosttokens":[]},"search_lead_in_dates":{"tokens":[["text","\/common\/search_dates"]],"defaults":[],"requirements":[],"hosttokens":[]},"false_leads_not_interested":{"tokens":[["text","\/common\/false_leads_not_interested\/"]],"defaults":[],"requirements":[],"hosttokens":[]},"false_leads_not_qualified":{"tokens":[["text","\/common\/false_leads_not_qualified\/"]],"defaults":[],"requirements":[],"hosttokens":[]},"false_leads_breakdown":{"tokens":[["text","\/common\/false_leads\/breakdown"]],"defaults":[],"requirements":[],"hosttokens":[]},"sales_dashboard_admin_contact_history":{"tokens":[["variable","\/","[^\/]++","contact"],["text","\/common\/contact\/history"]],"defaults":[],"requirements":[],"hosttokens":[]},"new_log_action":{"tokens":[["variable","\/","[^\/]++","taskId"],["variable","\/","[^\/]++","leadId"],["text","\/common\/new_log_action"]],"defaults":{"leadId":null,"taskId":null},"requirements":[],"hosttokens":[]},"create_log_action":{"tokens":[["variable","\/","[^\/]++","taskId"],["variable","\/","[^\/]++","leadId"],["text","\/common\/create_log_action"]],"defaults":{"leadId":null,"taskId":null},"requirements":[],"hosttokens":[]},"task_reschudle":{"tokens":[["text","\/reschudle"],["variable","\/","[^\/]++","time"],["variable","\/","[^\/]++","date"],["variable","\/","[^\/]++","id"],["text","\/task"]],"defaults":[],"requirements":{"_method":"GET"},"hosttokens":[]},"task_meetings_on_date":{"tokens":[["text","\/meetings"],["variable","\/","[^\/]++","date"],["variable","\/","[^\/]++","user"],["text","\/task"]],"defaults":[],"requirements":{"_method":"GET"},"hosttokens":[]},"task_cancel":{"tokens":[["text","\/cancel"],["variable","\/","[^\/]++","reason"],["variable","\/","[^\/]++","id"],["text","\/task"]],"defaults":[],"requirements":{"_method":"GET"},"hosttokens":[]},"lead_assignment":{"tokens":[["variable","\/","[^\/]++","slug"],["variable","\/","[^\/]++","id"],["text","\/lead\/assignment"]],"defaults":[],"requirements":[],"hosttokens":[]},"lead_potential":{"tokens":[["variable","\/","[^\/]++","reason"],["text","\/potential"],["variable","\/","[^\/]++","potential"],["variable","\/","[^\/]++","id"],["text","\/lead\/potential"]],"defaults":{"reason":null},"requirements":[],"hosttokens":[]},"lead_interest":{"tokens":[["variable","\/","[^\/]++","reason"],["variable","\/","[^\/]++","interest"],["variable","\/","[^\/]++","id"],["text","\/lead\/interest"]],"defaults":{"reason":null},"requirements":[],"hosttokens":[]},"find_lead":{"tokens":[["variable","\/","[^\/]++","mobile"],["text","\/lead\/mob"]],"defaults":[],"requirements":[],"hosttokens":[]},"lead_by_any":{"tokens":[["variable","\/","[^\/]++","single"],["variable","\/","[^\/]++","slug"],["text","\/lead\/any"]],"defaults":{"single":null},"requirements":[],"hosttokens":[]},"lead_urgent":{"tokens":[["text","\/"],["variable","\/","[^\/]++","urgent"],["variable","\/","[^\/]++","id"],["text","\/lead\/urgent"]],"defaults":[],"requirements":[],"hosttokens":[]},"call_create":{"tokens":[["variable","\/","[^\/]++","leadId"],["text","\/call\/create"]],"defaults":{"leadId":null},"requirements":{"_method":"POST"},"hosttokens":[]},"marketing_case_by_origin_widget":{"tokens":[["text","\/marketing\/casebyorigin_widget"]],"defaults":[],"requirements":[],"hosttokens":[]},"marketing_case_by_origin_communication_channel_widget":{"tokens":[["text","\/marketing\/casebyorigin\/communication_channel\/widget"]],"defaults":[],"requirements":[],"hosttokens":[]},"marketing_dashboard_leads_breakdown":{"tokens":[["text","\/marketing\/leads_breakdown"]],"defaults":[],"requirements":[],"hosttokens":[]},"marketing_dashboard_leads_breakdown_byrole":{"tokens":[["text","\/marketing\/leads_role"]],"defaults":[],"requirements":[],"hosttokens":[]},"marketing_dashboard_leads_breakdown_bycampaign":{"tokens":[["text","\/marketing\/leads_campaign"]],"defaults":[],"requirements":[],"hosttokens":[]},"marketing_dashboard_all_leads_breakdown":{"tokens":[["text","\/marketing\/leads_all"]],"defaults":[],"requirements":[],"hosttokens":[]},"marketing_archived_leads_data":{"tokens":[["text","\/marketing\/archived\/data"]],"defaults":[],"requirements":[],"hosttokens":[]},"marketing_dashboard_update_chart":{"tokens":[["text","\/marketing\/dashboard\/filter\/chart"]],"defaults":[],"requirements":[],"hosttokens":[]},"marketing_dashboard_update_channel":{"tokens":[["text","\/marketing\/dashboard\/filter\/channel"]],"defaults":[],"requirements":[],"hosttokens":[]},"marketing_dashboard_update_campaign":{"tokens":[["text","\/marketing\/dashboard\/filter\/campaign"]],"defaults":[],"requirements":[],"hosttokens":[]},"marketing_dashboard_update_role":{"tokens":[["text","\/marketing\/dashboard\/filter\/role"]],"defaults":[],"requirements":[],"hosttokens":[]},"marketing_leads_per_user_widget":{"tokens":[["text","\/marketing\/casebyorigin\/leadsperuser\/widget"]],"defaults":[],"requirements":[],"hosttokens":[]},"marketing_leads_per_database_widget":{"tokens":[["text","\/marketing\/casebyorigin\/leadsperdatabase\/widget"]],"defaults":[],"requirements":[],"hosttokens":[]},"sales_assign_leads":{"tokens":[["text","\/sales\/leads\/assign"]],"defaults":[],"requirements":[],"hosttokens":[]},"sales_assign_lead_sales_rep":{"tokens":[["variable","\/","[^\/]++","wasArchived"],["variable","\/","[^\/]++","salesRep"],["variable","\/","[^\/]++","lead"],["text","\/sales\/assign_lead_to_sales_rep"]],"defaults":{"wasArchived":false},"requirements":[],"hosttokens":[]},"sales_shuffle_lead":{"tokens":[["variable","\/","[^\/]++","includeMe"],["text","\/sales\/shuffle_lead"]],"defaults":[],"requirements":[],"hosttokens":[]},"sales_pipeline_move":{"tokens":[["text","\/sales\/pipeline\/move"]],"defaults":[],"requirements":[],"hosttokens":[]},"sales_dashboard":{"tokens":[["variable","\/","[^\/]++","id"],["variable","\/","[^\/]++","type"],["text","\/sales\/dashboard_"]],"defaults":{"type":null,"id":null},"requirements":[],"hosttokens":[]},"sales_dashboard_ajax_call_source":{"tokens":[["text","\/sales\/dashboard\/ajax\/call_source"]],"defaults":[],"requirements":[],"hosttokens":[]},"sales_dashboard_ajax_widgets":{"tokens":[["text","\/sales\/dashboard\/ajax\/widgets"]],"defaults":[],"requirements":[],"hosttokens":[]},"sales_dashboard_ajax_team_completion":{"tokens":[["text","\/sales\/dashboard\/ajax\/team_completion"]],"defaults":[],"requirements":[],"hosttokens":[]},"sales_representative_log_inbound_call":{"tokens":[["text","\/sales\/leads\/new"]],"defaults":[],"requirements":[],"hosttokens":[]},"sales_store_date":{"tokens":[["text","\/sales\/date"]],"defaults":[],"requirements":[],"hosttokens":[]},"sales_department_report_data":{"tokens":[["text","\/sales\/department_report\/data"]],"defaults":[],"requirements":[],"hosttokens":[]},"sales_team_report_data":{"tokens":[["text","\/sales\/department_report\/team_data"]],"defaults":[],"requirements":[],"hosttokens":[]},"sales_agent_dashboard":{"tokens":[["variable","\/","[^\/]++","id"],["text","\/sales\/dashboard"]],"defaults":{"id":0},"requirements":[],"hosttokens":[]},"sales_agent_lead_info":{"tokens":[["variable","\/","[^\/]++","lead"],["text","\/sales\/lead_info"]],"defaults":[],"requirements":[],"hosttokens":[]},"sales_agent_work_summary":{"tokens":[["variable","\/","[^\/]++","id"],["text","\/sales\/agent_work_summary"]],"defaults":{"id":0},"requirements":[],"hosttokens":[]},"sales_agent_performance":{"tokens":[["variable","\/","[^\/]++","id"],["text","\/sales\/agent_performance"]],"defaults":{"id":0},"requirements":[],"hosttokens":[]},"sales_agent_today_tasks":{"tokens":[["variable","\/","[^\/]++","id"],["text","\/sales\/agent_today_tasks"]],"defaults":[],"requirements":[],"hosttokens":[]},"sales_agent_upcoming_tasks":{"tokens":[["variable","\/","[^\/]++","id"],["text","\/sales\/agent_upcoming_tasks"]],"defaults":[],"requirements":[],"hosttokens":[]},"sales_agent_pending_tasks":{"tokens":[["variable","\/","[^\/]++","id"],["text","\/sales\/agent_pending_tasks"]],"defaults":[],"requirements":[],"hosttokens":[]},"callcenter_dashboard_report_data":{"tokens":[["text","\/callcenter\/dashboard\/report\/data"]],"defaults":[],"requirements":[],"hosttokens":[]},"callcenter_leads_ajax":{"tokens":[["text","\/callcenter\/dashboard\/leads"]],"defaults":[],"requirements":[],"hosttokens":[]},"callcenter_calls_ajax":{"tokens":[["text","\/callcenter\/dashboard\/calls"]],"defaults":[],"requirements":[],"hosttokens":[]},"callcenter_database_call_next_user":{"tokens":[["variable","\/","[^\/]++","database"],["text","\/callcenter\/database_call_next_user"]],"defaults":[],"requirements":[],"hosttokens":[]},"crm_sandbox_user_management_assign_target":{"tokens":[["variable","\/","[^\/]++","target"],["variable","\/","[^\/]++","user"],["text","\/settings\/usermanagement\/assigntarget"]],"defaults":[],"requirements":[],"hosttokens":[]},"sales_representative_update_property_price":{"tokens":[["variable","\/","[^\/]++","property"],["text","\/salesrepresentative\/ajax_update_property_price"]],"defaults":[],"requirements":[],"hosttokens":[]},"sales_representative_contact_history":{"tokens":[["variable","\/","[^\/]++","contact"],["text","\/salesrepresentative\/dashboardsalesrep\/contact_history"]],"defaults":[],"requirements":[],"hosttokens":[]},"leads_upload_progress":{"tokens":[["text","\/contacts\/leads_upload_progress"]],"defaults":[],"requirements":[],"hosttokens":[]},"comur_api_upload":{"tokens":[["text","\/upload"]],"defaults":[],"requirements":[],"hosttokens":[]},"comur_api_crop":{"tokens":[["text","\/crop"]],"defaults":[],"requirements":[],"hosttokens":[]},"comur_api_image_library":{"tokens":[["text","\/image-library"]],"defaults":[],"requirements":[],"hosttokens":[]}},"prefix":"","host":"","scheme":"http"});<?

1 个答案:

答案 0 :(得分:0)

此问题发生在javascript的创建路由映射...

在您的浏览器中打开路线请求:

http://PORJECT_URL/js/routing?callback=fos.Router.setData

在这个文件中你可以看到symfony的例外...

(此文件请求与主要请求分开,因此您无法看到它的异常......)

如果您看到日志文件,也可以看到异常