0

I want to add information inside div.latlong element on www.wta.org/go-hiking/hikes/high-rock) onto my website.

This code results in file not found.

$("#div1").load("http://www.wta.org/go-hiking/hikes/high-rock div.latlong");
user3562812
  • 1,751
  • 5
  • 20
  • 30
  • 1
    Possible duplicate of [How does Access-Control-Allow-Origin header work?](https://stackoverflow.com/questions/10636611/how-does-access-control-allow-origin-header-work) – Obsidian Age Oct 02 '17 at 01:46
  • ...you edited your post to remove the mention of no Access-Control-Allow-Origin header. A 'file not found' is not the same thing. If it doesn't exist, you can't grab the data. If it does exist, you need them to enable that header flag. – Obsidian Age Oct 02 '17 at 01:48
  • Read More about Cross-Origin. Alternate can try any server side scripts like php to run via ajax and load to #div1. PHP Code: `` – J.K Oct 02 '17 at 02:42

1 Answers1

0

In order to access elements from another site you'll need their server to accept CORS (cross origin requests)

To do this, you'll need access/permission to said webserver. So if it's owned by someone else that you do not know are unable to request such things from, it will be unable to be done. If you do you can enable CORS with various methods in both nginx and apache

jshbrmn
  • 1,737
  • 3
  • 22
  • 52