0

I have simple jQuery code where Im trying to like in PHP echo in jQuery to my website. But when I do it like this:

$( ".doc-list" ).html( "include 'documents.php';" );

My code echo it on site like:

include 'documents.php';

So my problem is when I make code like upwards jQuery echo it like plain text not like PHP and I need to include to my index.php documents.php when AJAX is done.

Matúš Rebroš
  • 141
  • 1
  • 7

1 Answers1

0

To load data from server use .load():

$( ".doc-list" ).load( "documents.php" );

Also, learn about client side and server side differences. Javascript (client-side) does not know anything about php code or any other code on your server side. Helpful question is here.

u_mulder
  • 54,101
  • 5
  • 48
  • 64