0

フォームがあり、テキスト ボックスの値を php 側に送信する必要があります。

私は常に変数の値を非表示にしてから、php 側に送信します。これはばかげていると思います。そのようなテキストボックスの値を送信する方法はありますか

$.post("adasda", {"degisken1":$("#txtEmail").val()} ,function(response){})
4

1 に答える 1

3

はい、jquery ajax 、 post または get メソッドを介してテキストボックスの値を送信できます。以下はサンプルの例です

$("#searchForm").submit(function(event) {
    /* stop form from submitting normally */
    event.preventDefault(); 

    /* get some values from elements on the page: */
    var $form = $( this ),
        term = $form.find( 'input[name="s"]' ).val(),
        url = $form.attr( 'action' );

    /* Send the data using post and and get the results */
    $.post( url, { s: term },
        function( data ) {
            // write your code here
        }
    );
});

詳細はこちらhttp://api.jquery.com/jQuery.post/

ありがとう

于 2012-04-18T12:50:00.657 に答える