Jump to content

Ajax results in input element


Recommended Posts

I am new at this and playing around right now to learn JQuery. I am am thankfull for resources and advice you might give.  I am sending a request to a file and I want the returned results to be entered  in a disabled input box

<script>
$(document).ready(function(){
    $("#req_btn").click(function(){
        $("#myResults").load("get_results.php");
    });
});
</script>
	Outcome: <input type="text" id="myResults"  name="myResults"  disabled>  
	

 

Link to post
Share on other sites

I don't think that the load method is a general-purpose thing that will know how you want to use the returned data, I think it's just for updating the HTML inside an element.  An input element does not contain HTML, so I don't think that's going to work.  Send a regular ajax request, get the response, and then you can use the input element's value property to change the value in the field.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...