How to load a PHP script into a div with jquery ajax?

$(document).ready(function(){ $("#S1").change(function() { var IDCat=this.value; $.ajax({ type: "GET", url: 'product_modify.php', data: {IDCat:IDCat}, success: function(data) { $("#p1").text(data); $("#tempForm").load('tv_form.php'); } }); }); }); 

This is my code, in load() , when I call the tv_form.html file, it works, but when I call 'tv_form.php' it doesn’t work, error 403 is forbidden, what is the problem? .Html works, but .php doesn’t work .

+1
source share
1 answer

Add a name instead of a file name.

 $(document).ready(function(){ $("#S1").change(function() { var IDCat=this.value; $.ajax({ type: "GET", url: 'product_modify.php', data: {IDCat:IDCat}, success: function(data) { $("#p1").text(data); $("#tempForm").load('URL to tv_form.php'); // www.example.com/file.php } }); }); }); 
0
source

Source: https://habr.com/ru/post/972415/


All Articles