2011-05-11 81 views
0

我有這樣的代碼。firefox語法錯誤

在line.php文件: 簡單speeking,我只輸出字符串時查詢此頁:

<?php 
print("love you") 
?> 

然後在b.php,我使用的模板代碼波紋管(PHP模板),我有這樣的代碼 我將調用draw_line_chart函數,該函數將查詢line.php以獲取輸出。

function get_char(product,project){ 
    var lineUrl = 'line.php'; 
    send_http_request(lineUrl,_plot_line); 

    function _plot_line(request){ 
    ;//plot_line(request,product,project) //function to get the line code . 
    } 
} 


function send_http_request(url,call_function){ 
    if (window.XMLHttpRequest) { // Mozilla, Safari,... 
     http_request = new XMLHttpRequest(); 
     if (http_request.overrideMimeType) { 
     http_request.overrideMimeType('text/xml'); 
     } 
    } else if (window.ActiveXObject) { // IE 
     try { 
     http_request = new ActiveXObject("Msxml2.XMLHTTP"); 
     } catch (e) { 
     try { 
    http_request = new ActiveXObject("Microsoft.XMLHTTP"); 
     } catch (e) {} 
     } 
    } 
    if (!http_request) { 
     alert('Giving up :(Cannot create an XMLHTTP instance'); 
     return false; 
    } 
    http_request.onreadystatechange=function(){ 
    if(http_request.readyState == 4){ 
     call_function(http_request); 
    } 
    } 
    http_request.open('GET',url,false); 
    http_request.send(null); 
    return http_request; 
} 

OK,當它在谷歌瀏覽器使用,它是正確的,但在Firefox的時候。它走錯了。而在錯誤控制檯,它說syntax error "love you"

+2

其中是'plot_line'函數/ firefox說錯誤駐留在哪裏?它應該給你一個文件+行參考 – Quamis 2011-05-11 10:33:54

+0

它不關心什麼plot_line做,如果我想念它,仍然是錯的。 – mike 2011-05-11 12:17:49

+1

另外,值得一提的是,像jQuery或mootools這樣的庫可以包含這種類型的內容......都包含健壯且易於使用的AJAX請求。 – eykanal 2011-05-11 12:23:25

回答

0
print("love you"); 

你缺少在函數結束的分號。

+0

這不是關於;分號 – mike 2011-05-11 12:18:28