0

.post()Python関数でデバイスのステータスを照会するために使用します。の場合はdone、python 関数の戻り値で返ってくるはずです。

$.post('/request', {inputText: fbNum,key_pressed: fbType.toString()}).done(function (reply) {
      if (reply ^= "count") {
             $('#status_table tr #'+eachStatus).empty().append(the-reply-value-here);
      } });

私のpythonファイルの一部:

elif "C?" in response[0]:
         status="Count= %sH"%response[0].strip()[-2:] 
return status

ステータスを取得して表示するにはどうすればよいですか? .getjqueryで使用しますか?しかし、私はその形式に自信がありません。それは...ですか

$.get("/request", reply).done(function(data){
    $('#status_table tr #'+eachStatus).empty().append(the-reply-value-here);});

??

しかし、私がする返事はのようなものCount = FFです。表示したいのはFF. どうすればいいですか?

4

1 に答える 1

1

試す

$.post('/request', {inputText: fbNum,key_pressed: fbType.toString()}).done(function (reply) {
    if (/^Count\s*=/.test(reply)) {
        $('#status_table tr #'+eachStatus).empty().append(reply.replace(/Count\s*=\s*/, ''));
    } 
});
于 2013-05-07T03:24:45.870 に答える