如何加载的PHP脚本到的div使用jQuery AJAX? [英] How to load php script into div with jquery ajax?
本文介绍了如何加载的PHP脚本到的div使用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');
}
});
});
});
这是我的code,在负载()
函数时,我称之为tv_form.html文件,它的工作原理,但是当我叫'tv_form.php这是行不通的,错误是403禁止
问题出在哪里? html的作品,但的.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.
推荐答案
添加,而不是文件名的URL。
Add URL instead of 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
}
});
});
});
这篇关于如何加载的PHP脚本到的div使用jQuery AJAX?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文