在此服务器上找不到请求的 URL /undefined
我有以下代码:
<a class="quickrate lightGreyBtn" href="selectmovie.php">Launch Quick Rate</a>
//this is inside my javascript
$(".lightGreyBtn").click(function() {
$.fancybox({
'width' : '75%',
'height' : '75%',
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe'
});
return false;
});
当我单击按钮时,出现错误:
The requested URL /undefined was not found on this server.
这是我的 selectmovie.php 中的内容
<body id="quickstart">
<div id="dialog" style="display: block;">
<div>
<h1><strong>Rate <span class="number">10</span> movies you like</strong> and start finding new favorites.</h1>
<ul class="items">
<li data-page="1">
<ul class="clearfix quickstart objects">
<?php
$db = new PDO("mysql:host=localhost;dbname=test;",'root','test');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->beginTransaction();
$result = $db->prepare("SELECT MID, TITLE, URL FROM movie WHERE YEAR = ? AND URL != ? ORDER BY RAND() LIMIT 8");
$result->execute(array(2011, 'http://cdn-5.nflximg.com/us/boxshots/large/70144645.jpg'));
$movies = $result->fetchAll(PDO::FETCH_ASSOC);
foreach ($movies as $movie)
{
//create some html code using echo here
}
?>
</ul>
</li>
</ul>
<a href="#" data-page="1" data-nexttoken="1301018340333" data-total="135" data-seed="1301018340333" class="next newBlue">More Movies »</a>
</div>
</div>
</body>
问题是什么?
I have the following code:
<a class="quickrate lightGreyBtn" href="selectmovie.php">Launch Quick Rate</a>
//this is inside my javascript
$(".lightGreyBtn").click(function() {
$.fancybox({
'width' : '75%',
'height' : '75%',
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe'
});
return false;
});
When I click on the button I get the error:
The requested URL /undefined was not found on this server.
Here's what I have in my selectmovie.php
<body id="quickstart">
<div id="dialog" style="display: block;">
<div>
<h1><strong>Rate <span class="number">10</span> movies you like</strong> and start finding new favorites.</h1>
<ul class="items">
<li data-page="1">
<ul class="clearfix quickstart objects">
<?php
$db = new PDO("mysql:host=localhost;dbname=test;",'root','test');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->beginTransaction();
$result = $db->prepare("SELECT MID, TITLE, URL FROM movie WHERE YEAR = ? AND URL != ? ORDER BY RAND() LIMIT 8");
$result->execute(array(2011, 'http://cdn-5.nflximg.com/us/boxshots/large/70144645.jpg'));
$movies = $result->fetchAll(PDO::FETCH_ASSOC);
foreach ($movies as $movie)
{
//create some html code using echo here
}
?>
</ul>
</li>
</ul>
<a href="#" data-page="1" data-nexttoken="1301018340333" data-total="135" data-seed="1301018340333" class="next newBlue">More Movies »</a>
</div>
</div>
</body>
What is the issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
传递给
$.fancybox
的对象中没有href
属性。尝试在'type' : 'iframe'
之后添加此内容(当然,您还需要在'iframe'
之后添加逗号):There's no
href
property in the object passed to$.fancybox
. Try adding this after'type' : 'iframe'
(you'll need a comma after'iframe'
, too, of course):尝试使用绝对路径而不是相对路径!
尝试检查 Apache 错误日志,也许您可以在那里获得有关错误的更多信息。
尝试仅运行 PHP 脚本并检查是否成功!
try using absolute path instead of relative path !
try checking the Apache error log, perhaps you can get some more info about the error there.
try running only the PHP script and check if it succeed !