-1

I have my index.html page from where I want dynamic data to be loaded from a database using php, but I don't know how to call that php file from my html page such that code and queries inside php files get executed and returns the html to the html page.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Vivek Mishra
  • 367
  • 3
  • 5

1 Answers1

1

In .html file use ajax, and call the php file in ajax.

$.ajax({
    url:"path to php file",
    data:{key:value},// send any data if required to php file
    type: "POST",
    success: function(data){
         alert("php code executed successfully.");
    }
});
Niranjan N Raju
  • 12,047
  • 4
  • 22
  • 41