views:

84

answers:

2

Let's say I have a PHP page and inside that PHP page I just have <?php echo "Hello World!"; ?> and I want to use JavaScript (preferabbly jQuery) and AJAX to CALL that php page and return it's output (which would be "Hello World!")

How is this done?

+9  A: 

Pretty basic.

jQuery.ajax() – jQuery API

You'll find lots of examples near the bottom.

Stephen
+1 Everything that is needed and more.
Frederico
+2  A: 

The data will contain the text from the page, do what you want with it. In this case, set the #responseArea text to contain it.

$.ajax({
   url: "yourPage.php",
   success: function(data){
     $("#responseArea").text(data);
   }
 });
Robert