Display ajax response into input field

后端 未结 2 657
北海茫月
北海茫月 2021-01-18 09:28

is there any way to display ajax response into input field? thanks

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-18 10:15

    Yes.

    Using jQuery this looks like:

    $.ajax({
      url: '/test.php',
      success: function(data) {
        $('#your-input').val(data);
      }
    });
    

提交回复
热议问题