Load A Php Query File In An Html Index Page Using Ajax Or Jquery
index.html
Solution 1:
$(document).ready(function() {
jQuery.ajax({
type: "POST", // this is post request u can also do get request
url: "query.php",
dataType: "text",
success: function (response) // this is the response from url: "query.php",
{
alert(response); //alert responce from query.php and here you can do
// whatever u like with response.
},
error:function (xhr, ajaxOptions, thrownError)
{
alert(xhr); // if any error function.
}
});
});
Solution 2:
Use AJAX
in yout index.html
like this:
$(document).ready(function{
$.ajax({
url: "query.php"
}).done(function(data) {
$('body').html(data);
});
});
Make sure that you have included jQuery in your code.
Post a Comment for "Load A Php Query File In An Html Index Page Using Ajax Or Jquery"