h2O h2O - 29 days ago 7x
Ajax Question

Load an ajax request in a text box

I want to load an AJAX request in a text box. I tried loading the AJAX request using load :-


But, it did not work, though the same code worked for a div :-


Is there any such function to load the AJAX request in a textbox? Any help will be appreciated.


Why dont you use the $.ajax method? in success block get the value out of your response data and set it in your textbox

    type: 'POST',
    dataType: 'json',
    url: 'file.php',
    success: function( data ) {

    error: function(xhr, status, error) {



$.get('file.php', function(data) {