如何使用jquery ajax将php脚本加载到div中?

时间:2022-09-13 01:25:02
$(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');
            }                    
        });
    });
});

It is my code , in load() function when I call 'tv_form.html' file it works, but when i call 'tv_form.php' it doesn't work , error is 403 forbidden where is the problem ? .html works, but .php doesn't work.

这是我的代码,在我调用'tv_form.html'文件时它在load()函数中工作,但当我调用'tv_form.php'时它不起作用,错误是403禁止在哪里出问题? .html工作,但.php不起作用。

1 个解决方案

#1


0  

Add URL instead of file name.

添加URL而不是文件名。

$(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
            }
        });
      });
});

#1


0  

Add URL instead of file name.

添加URL而不是文件名。

$(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
            }
        });
      });
});