0

Well I want to get a paragraph which is inside <p id="dummy"> ... </p> on some webpage www.source.com to my webpage www.destination.com .I can only use AJAX,Javascript or Jquery or a similar library due to deveopment restriction.

I found 2-3 similar questions like this but I they totally confused as some guy says you cannot do this using Javascript with 3 upvotes but at the same time another post on a website is using some Javascript code and its working for him well.

I am new to this.Please help me.

How can I do this.A small dummy code would be helpful.

Community
  • 1
  • 1
Naveen
  • 7,944
  • 12
  • 78
  • 165
  • 1
    You can't do ajax due to cross domain restrictions and simple solution can be to create some python/perl server side (on same server where's your JS) script which would query www.source.com and which would return parsed data to your ajax. You can target this script with your ajax. – Slaven Tomac Nov 12 '13 at 13:13
  • 3
    Ajax cannot directly access the HTML of a page on a different domain ([Same Origin Policy](http://en.wikipedia.org/wiki/Same-origin_policy)). There are a number of workaround solutions for this. Look at the following Question's Answer to see some helpful items : http://stackoverflow.com/questions/15005500/loading-cross-domain-html-page-with-jquery-ajax – Nunners Nov 12 '13 at 13:15
  • @SlavenTomac : As I already mentioned,I cannot use anything other than Jquery,Javascript or AJAX. Because I am going to convert this project into a desktop application using AppJS and I can't use python or PHP with it – Naveen Nov 12 '13 at 13:18
  • You really need to understand Same Origin Policy that @Nunners is talking about. – j0hnstew Nov 12 '13 at 13:20
  • possibly try with php curl. You can over come with cross-domain issues. – ram Nov 13 '13 at 06:39
  • **I wrote an answer for this question here: [Loading cross domain html page with jQuery AJAX](http://stackoverflow.com/questions/15005500/loading-cross-domain-html-page-with-jquery-ajax/17299796#17299796)** – _the last one, supports https_ – jherax Jun 26 '14 at 14:34

0 Answers0