I have a jquery ajax post and when a user write and press enter in a textbox this ajax triggers then it fetches a value from backend and show the result in a <pre>
html element. http://jsfiddle.net/LQg7W/2133/ obviuosly this jsfiddledoes not show anything because I sis not put the ajax post inside it.
I want this text value have a default value when I load the page. like "Enter your value:" but how can I send this value to the textbox which is in template? So what I want to do is to send this defult value from my view to template.
here is my view code when the user hit enter:
if(e.keyCode == 13) {
var currentLine = $('#terminal').text();
var inputData = $(e.currentTarget).val();
$('#terminal').text(currentLine + "\r\n" + inputData + "\r\n");
AjaxPost(inputData);
}
}
and this is how I render my template (textbox is inside this template)
this.$el.html(this.cliTerminalTemplate());
and this is my template:
<div class="row" id="box">
<div class="large-12 columns" >
<pre id="terminalPre" width="2">
<code id="terminal" style="color: #fff; padding: 1em;" ></code>
</pre>
<input type="text" id="textInput" name="" border: none;" autofocus>
</div>
</div>