h2O h2O - 1 year ago 66
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.

Answer Source

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) {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download