Javascript 正在尝试将jQuery转换为原型。。。引起问题的jQuery
我有以下代码:Javascript 正在尝试将jQuery转换为原型。。。引起问题的jQuery,javascript,php,jquery,ajax,prototypejs,Javascript,Php,Jquery,Ajax,Prototypejs,我有以下代码: <script type='text/javascript' src='js/jquery.js'></script> <script type='text/javascript'> var last_song = '$song[1]'; var jqy = jQuery.noConflict() var change_radio = setInterval(function () {
<script type='text/javascript' src='js/jquery.js'></script>
<script type='text/javascript'>
var last_song = '$song[1]';
var jqy = jQuery.noConflict()
var change_radio = setInterval(function ()
{
jqy.ajax({
url : 'modules/ajax/refresh.php',
type : 'GET',
data : {lastsong: 'last_song'},
success: function(data)
{
last_song = data;
jqy('#radio').html(last_song);
}
});
}, ($refresh*1000));
change_radio;
</script>
var last_song=“$song[1]”;
var jqy=jQuery.noConflict()
var change_radio=setInterval(函数()
{
jqy.ajax({
url:'modules/ajax/refresh.php',
键入:“GET”,
数据:{lastsong:'last_song'},
成功:功能(数据)
{
最后一首歌=数据;
jqy(“#radio”).html(最后一首歌);
}
});
},($refresh*1000));
更换收音机;
refresh.php
<?php
$lastsong = $_GET['lastsong'];
$timeout = "2"; // Number of seconds before connecton times out.
$ip[1] = "198.101.13.110"; // IP address of shoutcast server
$port[1] = "8000"; // Port of shoutcast server
//$song = [];
//$msg = [];
//END CONFIGURATION
$servers = count($ip);
$i = "1";
while ($i <= $servers)
{
$fp = @fsockopen($ip[$i], $port[$i], $errno, $errstr, $timeout);
if (!$fp)
{
$listeners[$i] = "0";
$msg[$i] = "<span class=\"red\">ERROR [Connection refused / Server down]</span>";
$error[$i] = "1";
}
else
{
fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla\r\n\r\n");
while (!feof($fp)) $info = fgets($fp);
$info = str_replace('<HTML><meta http-equiv="Pragma" content="no-cache"></head><body>', "", $info);
$info = str_replace('</body></html>', "", $info);
$stats = explode(',', $info);
if (empty($stats[1]))
{
$listeners[$i] = "0";
$msg[$i] = "<span class=\"red\">ERROR [There is no source connected]</span>";
$error[$i] = "1";
}
else
{
if ($stats[1] == "1")
{
$song[$i] = $stats[6];
$listeners[$i] = $stats[4];
$max[$i] = $stats[3];
// Both IFs the same? Please check that and make one only if its the case
if ($stats[0] == $max[$i]) $msg[$i] = "<span class=\"red\">";
if ($stats[0] == $max[$i]) $msg[$i] .= "</span>";
}
else
{
$listeners[$i] = "0";
$msg[$i] = " <span class=\"red\">ERROR [Cannot get info from server]</span>";
$error[$i] = "1";
}
}
}
$i++;
}
if($song[1] != "")
{
echo $song[1];
exit();
}
echo uriencode($lastsong);
?>
我想把它改为使用原型。我已经使用了prototype和jQuery,正如我所写的,这是相互冲突的。我不知道从哪里开始,但任何帮助都将不胜感激。。。尤其是在我的处境中有很多人。非常感谢。控制台中会抛出哪些错误?如果您先加载jQuery并继续使用
noConflict
,应该不会有任何问题,您应该从学习prototypejs库开始。。。或者完全跳过这些库,只使用本机API。这只是一点点代码。仅仅为此加载一个库是很遗憾的。你的PHP代码与这个问题有什么关系?如果不是,请将其删除,并发布您尝试使用该代码段的原型。另外,jQuery导致了什么问题?