如何在我的页面中加载此jquery获取响应中间iframe? php脚本从mysql db加载一些数据? 在这种情况下,我没有传递任何数据到PHP所以我需要提出获取或发布请求? 我的代码在alert中显示jquery响应,但是没有将它加载到iframe中!
setInterval(function() {
$.ajax(
{
type: 'GET',
url: './getDataFromMySQLdb.php',
//data: $("#myform").serialize(),
data: {
title: 'test',
// wrapper: 'testing'
},
success: function (good)
{
//handle success
alert(good);
$("#middle").attr('src',+good); //change url
},
failure: function (bad)
{
//handle any errors
alert(bad)
}
});
}, 20000);
How i can load this jquery get response to middle iframe in my page? The php script loads some data from mysql db? in this case i am not passing any data to php so do i need to make get or post request ? my code display the jquery response in alert but doesn't load it into iframe!
setInterval(function() {
$.ajax(
{
type: 'GET',
url: './getDataFromMySQLdb.php',
//data: $("#myform").serialize(),
data: {
title: 'test',
// wrapper: 'testing'
},
success: function (good)
{
//handle success
alert(good);
$("#middle").attr('src',+good); //change url
},
failure: function (bad)
{
//handle any errors
alert(bad)
}
});
}, 20000);
原文:https://stackoverflow.com/questions/14865658