Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get Url source code via Javascript
11-01-2013, 05:21 PM,
Post: #1
How to get Url source code via Javascript
Get Url source code via PHP function is
file_get_contents('http://');

i want to get url source code via javascript.

Please help me . Thanks.
Reply
11-03-2013, 02:36 PM, (This post was last modified: 11-03-2013, 02:36 PM by ionutvmi.)
Post: #2
RE: How to get Url source code via Javascript
You can have the file_get_contents() in js also.
You can find more about it here http://phpjs.org/functions/file_get_contents/ this is a good option if you are not using any framework.

However if you use jquery you can do it like this:

Code:
$.get( "ajax/test.html", function( data ) {
  $( ".result" ).html( data );
  alert( "Load was performed." );
});
you can find the full documentation here http://api.jquery.com/jQuery.get/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)