2
我得到生產該錯誤只FOSJSRoutingBundle的Symfony2 =>未捕獲的SyntaxError:意外的標記<
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"});<?
那麼,如何看待這兩行HTML的時候呈現? – zerkms
實際腳本在生成時的外觀如何?它看起來像是正在生成的腳本源中存在錯誤,所以它創建了一個HTML錯誤頁面,而不是模板中的任何內容。如果您轉到由{{path('fos_js_routing_js',{'callback':'fos.Router.setData'})}}生成的路徑,您可能會獲得更多信息。 – qooplmao
@qooplmao更新了我的文章 –