i have a code like this .
in a line.php file: in simple speeking , i just output a string when query this page:
<?php
print("love you")
?>
then , in a b.php , i use the template code bellow (php template),i have code like this i will call the draw_line_chart function , this function will query line.php to get the output .
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 s开发者_如何学Goend_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, when it is used in google chrome , it's right , but when in firefox. it go's wrong . and in the error console , it say syntax error "love you"
print("love you");
you are missing the semi-colon at the end of the function.
精彩评论