2013-08-16 17 views
0

編輯:這個錯誤是由我的Facebook像腳本造成的,但是這個腳本仍然無法正常工作,但沒有拋出任何錯誤。獲取頁面並找到div內容,然後顯示不起作用

我想顯示另一個頁面的一部分,通過使用$ get和.find jquery函數,但它給我一個錯誤。我希望看到當我不是時,我是否將它連接到外部域。

這裏是我的代碼:

 var ComponentSrc = "http://localhost/acatalog/8ft_Trampoline_Tent.html"; 
     $.get(ComponentSrc, function(data){ 
      $(this).children('div').html($(data).find('.page-content').html()); 
     }) 

但是從以下網址運行此時:http://localhost/acatalog/8ft_Fun_Pink_Trampoline.html

它給我這個錯誤:

Given URL is not permitted by the application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.

我意識到這個錯誤將顯示如果我沒有鏈接到相同的域名,但我不是。是因爲它的本地主機?

+1

這不是一個CORS錯誤,這是一個FaceBook API錯誤。你的網頁是否使用FaceBook? – Barmar

+0

如果將錯誤消息放入SO搜索框中,您會發現很多示例。 – Barmar

+0

[給定的URL不被應用程序配置允許]的可能重複(http://stackoverflow.com/questions/16345777/given-url-is-not-allowed-by-the-application-configuration) – Barmar

回答

2

你應該使用$('div#result').load('http://localhost/acatalog/8ft_Trampoline_Tent.html .page-content');更簡單

+0

這應該是一個評論,它與修復錯誤無關。 – Barmar

+0

使用此工作,而不是我的上面的腳本,謝謝 –

相關問題