lse123 Posted May 28, 2012 Share Posted May 28, 2012 At http://www.w3schools.com/jquery/jquery_ajax.aspthere are some jQuery ajax examples, when want to get other server url's html code page (and preferred only div text with id=("article_main")), well below code failed, is only for native urls? what to use in this case or in case of an otherserver/page.html? txt1=xmlhttp.responseText;txt=txt1.getElementsById("article_main"); <html><head><script type="text/javascript" src="jquery.js"></script><script type="text/javascript">$(document).ready(function(){ $("button").click(function(){ alert("pressed"); $("#gl").load("http://www.yyyy.com/cyprus-property/taxes-fees.html"); }); });//});</script></head><body><p>Artists</p><div id="gl"></div><button>Get html info</button></body></html> Link to comment Share on other sites More sharing options...
Ingolme Posted May 28, 2012 Share Posted May 28, 2012 AJAX, originally, only works for the same domain. I don't know yet if browsers have extended the permissions beyond that. If you need to get content from another domain you will need to get a server-side language to load the content for you. PHP, for example, has the cURL library. Link to comment Share on other sites More sharing options...
divinedesigns1 Posted May 29, 2012 Share Posted May 29, 2012 whats a cURL library? Link to comment Share on other sites More sharing options...
birbal Posted May 29, 2012 Share Posted May 29, 2012 whats a cURL library? http://php.net/curl Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now