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 iOS 自定义输入法-第三方输入法
    • ¥15 很想要一个很好的答案或提示
    • ¥15 扫描项目中发现AndroidOS.Agent、Android/SmsThief.LI!tr
    • ¥15 怀疑手机被监控,请问怎么解决和防止
    • ¥15 Qt下使用tcp获取数据的详细操作
    • ¥15 idea右下角设置编码是灰色的
    • ¥15 全志H618ROM新增分区
    • ¥15 在grasshopper里DrawViewportWires更改预览后,禁用电池仍然显示
    • ¥15 NAO机器人的录音程序保存问题
    • ¥15 C#读写EXCEL文件,不同编译