Display ajax response into input field

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

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

2条回答
  •  耶瑟儿~
    2021-01-18 10:22

    check this : jQuery.ajax()

    $("id").val(
     $.ajax({
          url: "script.php",
          global: false,
          type: "POST",
          data: ({id : this.getAttribute('id')}),
          dataType: "html",
          async:false,
          success: function(msg){
             alert(msg);
          }
       }
    ).responseText);
    

提交回复
热议问题