NatFan9
NatFan9

Reputation: 43

Can javascript content be shared between two pages?

I'm trying to make a sort of map with data that overlays based on what a user selects. Currently, I just have the image on the same page shrunken, but it's rather hard to read. I was thinking I could have the entire image in an iframe and just have the user be able to scroll around the map, but Im not sure if I can use the javascript between the two pages. Would it be possible or do I have to figure out another way to get a full size image?

http://xicorp.webs.com/airlinemap.html

Upvotes: 1

Views: 169

Answers (2)

Sean Lindo
Sean Lindo

Reputation: 1437

Yes you can. In fact, you can call functions in one javascript file that only exist in another (provided you add them in the right order).

If you aren't in the same domain, you can use JSONP to freely send cross-domain requests back and forth.

jsonp with jquery

Upvotes: 0

bmarti44
bmarti44

Reputation: 1247

If the two pages are on the same domain, then you will be able to transfer information between them. If not, there are still ways to transfer JSON data between domains (using JSONP) but it will be much harder.

Upvotes: 2

Related Questions