views:

208

answers:

1

How can I generate a result from jquery + ajax in a another text box

<form action="someanotherpage.php">
   <input type="text" name="data" value="" id="data"/>
   <input type="text" name="response_data_here" value="" id="response"/>
    <input type="submit" value="Apply" />
</form>

EDIT: I edited some content..Im so sorry forgot to mention that I will use the #data textbox to query it in a database and I will display the result in the #response textbox ,forgive me I was confused at the moment

any suggestion guys?is that possible?any help is appreciated. thanks

A: 

This must do the trick:

Your Form:

<form action="someanotherpage.php">
   <input type="text" name="data" value="" id="data "/>
   <input type="text" name="response_data_here" value="" id="data2" />
</form>

JQuery:

$(function(){
  $("#data").keypress(function(){
    $("#data2").val($(this).val());
  });
});
Sarfraz
sorry about my question,I updated it , forgot to mention that I need to use the #data to query it in a database, the form that I want to achieve is like a autocomplete form, sorry about my grammar also.
arnold