Jump to content

Ajax results in input element


IndianaGuy

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 comment
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 comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...