weixin_33671935 2013-11-10 02:22 采纳率: 0%
浏览 28

Ajax,Javascript,Python

From a python script located at /script.py, I want to see storeNum on the html page.

def testpost(storeNum):
    storeNum = int(storeNum) + 1
    return storeNum

Then on the html page I have JScript

function create_xml_http() {
    if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
        var xmlhttp = new XMLHttpRequest();
    } else { // code for IE6, IE5
        alert("This page does not support Internet Explorer.  Please open in another\\
       browser.")
    }
    return xmlhttp;
}

function sendStoreNum() {
    var storeValue = +document.getElementById('strNum').value;
    if (storeValue == '') {
        return;
    }
    var sendStoreNum.onreadystatechange = create_xml_http();
    var url = 'home/jholstine/workspace/oreilly/sqltest.py/testpost'
    if (storeValue >= 1) {
        alert('made it to post');
        sendStoreNum.open('POST', url, true);
    } else {
        alert('You have enter a text instead of a number!');
        sendStoreNum.send();
        storeValue.value = '';
        return
    }
}

I can't seem to get these two to talk. I just want to enter the number into a text box and hit enter. Then have it send back the store number plus 1. Can someone please help make these to talk?

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥50 汇编语言除法溢出问题
    • ¥65 C++实现删除N个数据列表共有的元素
    • ¥15 Visual Studio问题
    • ¥15 state显示变量是字符串形式,但是仍然红色,无法引用,并显示类型不匹配
    • ¥20 求一个html代码,有偿
    • ¥100 关于使用MATLAB中copularnd函数的问题
    • ¥20 在虚拟机的pycharm上
    • ¥15 jupyterthemes 设置完毕后没有效果
    • ¥15 matlab图像高斯低通滤波
    • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗