Sorry for being such a beginner but I spent days try to find an answer and now I think your expertise is needed.
I try to do something like "If I click on li, then the text written in li is displayed in a search box (ID '#input#) and automatically the request is launched."
My script works fine but the request/search IS NOT launched.I blocked at the last step of the process.
Thank you very much for your help.
HTML
<ul id="test">
<li>Hello world</li>
<li>Hello world 2</li>
</ul>
Javascript, JQuery
<script type="text/javascript">
$(document).ready(function(){
$("#test li").click(function (){
varindex = $(this).text();
$('#input').val("Text is in the search box!"+" "+varindex);
});
});
</script>
<script type="text/javascript">
$(document).ready(function(){
$("#test li").click(function (){
$('#input').focus();
$('#input').trigger(jQuery.Event('key', {which: 13}));
});
});
</script>