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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器