PHP数组和ajax
如果有人能在这里帮助我,我真的很感激...我有点卡住了
functions.php
--------------
class stats{
public function Updates()
{
$query = mysql_query("SELECT blah blah ") or die(mysql_error());
while($row=mysql_fetch_array($query))
$data[]=$row;
if(!empty($data))
{
return $data;
}
}
--------------
div_load.php
--------------
include_once('functions.php');
$son = new stats();
$updatesarray=$son->Updates();
if($updatesarray)
{
foreach($updatesarray as $data)
{
$name=data['name'];
<div >blah blah</div>
}
}
-----------
index.php
-----------
,我试图使用jquery加载函数获取新内容...而不是每次都刷新页面...它与页面刷新一起使用..但是我无法让它与jquery加载函数一起使用..可以使用帮助..谢谢
I would really appreciate it if someone could help me out here ... im kinda stuck
functions.php
--------------
class stats{
public function Updates()
{
$query = mysql_query("SELECT blah blah ") or die(mysql_error());
while($row=mysql_fetch_array($query))
$data[]=$row;
if(!empty($data))
{
return $data;
}
}
--------------
div_load.php
--------------
include_once('functions.php');
$son = new stats();
$updatesarray=$son->Updates();
if($updatesarray)
{
foreach($updatesarray as $data)
{
$name=data['name'];
<div >blah blah</div>
}
}
-----------
index.php
-----------
im trying to get new content using jquery load function.... rather than a page refresh every time ... it works with page refresh .. but i cannot get it to work with jquery load function .... could use the help .. thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道为什么你要在这里实例化一个函数,但你应该只调用该函数,你应该只实例化类......
你应该能够只调用
$son = Updates();
另外,Updates 函数是否包装在一个名为updates 的类中?如果不是,该代码将会出错...并且您也没有向我们展示回答问题所需的 jquery 或 html 代码。
I'm not sure why you are instantiating a function here, but you should just call the function, you should only instantiate classes...
You should be able to just call
$son = Updates();
also, is the Updates function wrapped in a class called updates? If not that code would error out... and you are not showing us the jquery or html code either, which is needed to answer the question.
index.php 仅包含 include(div-load.php)
至于 jquery 部分,我正在执行 $(selector).live(click, function(){ this.load()});
index.php just contains include(div-load.php)
As for jquery part im doing $(selector).live(click, function(){ this.load()});