Display ajax response in input box

Is there any way to show ajax response in input field? thanks

+4
source share
2 answers

Yes.

Using jQuery is as follows:

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

check this out: 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); 
+1
source

Source: https://habr.com/ru/post/1334637/


All Articles