您好,我有一个python脚本,我正试图使用AJAX调用从客户端从PHP运行该脚本:$.ajax({
async: false,
cache:false,
url:"callpython.php",
type: "POST",
data: "data1=" + path + "&data2=" + clr[k0],
success: function (response) {
console.log(response);
}});
callpython.php中的代码是:
^{pr2}$
而myscript.py中的代码是:#!/usr/bin/env python
# -*- coding: utf-8 -*-
import string
import cgi, cgitb
from lxml import etree
from PIL import Image
pet="images/rock1.png"
petColor="59A678"
.//The rest of the code that populates the variables printed down below
.
.
.
print "Content-type: text/html"
print eyeSize
print displacementX
print displacementY
print distance
print textX
print textY
print sizeText
print colorText
Ajax的结果是:Array
当我从控制台运行php代码时:php callpython.php它执行python脚本并给出:["Content-type: text\/html","","30","37","47","20","27","40","20","#91806F"]
但当使用ajaxfirebug调用同一个php文件时,我发现结果是:[]。在
那么,如何在Ajax调用中获得与控制台结果相同的结果呢?在
谢谢。在