1

jqueryを使用してこのようなことを試しましたが、失敗しました。

$.ajax({ type: "POST", url: "myphphere.php", data: { command: $('#command').var() } });

また、ボタンのonclick属性を使用してページを更新し、フォームを送信することも考えました。

4

2 に答える 2

-1

なぜtargetフォームで属性を使用するのですか?

<form action="..." target="an_iframe" type="post">
<input type="text" name="cmd" placeholder="type a command here..." />
<input type="submit" value="Run!" />
</form>
<iframe id="an_iframe"></iframe>

それがあなたの問題を解決したことを願っています。

于 2013-03-24T20:09:34.457 に答える
-1

JqueryAjaxはあなたが必要とするものです。

コマンドをphpスクリプトに送信するのは簡単です:

  $.ajax({
      type: "POST",
      url: "some.php",
      data: { command: $('#command').val()}
    }).done(function( msg ) {
      alert( "result : " + msg );
  });

コマンドの結果を受け取り、好きな場所に表示できます(ページを更新する必要はありません)

于 2013-03-24T20:11:21.267 に答える