doucai6663 2014-10-27 01:00
浏览 27

试图将jQuery转换为原型... jQuery导致问题

I have the following code:

<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>

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
User-Agent: Mozilla

");
            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);

?>

And I want to change it to use prototype instead. I use prototype and jQuery already, and this is conflicting as written. I've no idea where to begin, but any assistance would be appreciated... especially since there are a lot of folks in my situation. Thanks so much.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 msix packaging tool打包问题
    • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
    • ¥15 python的qt5界面
    • ¥15 无线电能传输系统MATLAB仿真问题
    • ¥50 如何用脚本实现输入法的热键设置
    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线