我有三个文本框,当我在第一个文本框中写东西时,我将值发送到state.jsp并显示它 通过out.println(firsttextboxvalue);通过第二个文本框响应ID。但我想在第一个文本框中的onkeyup事件中填充第三个文本框作为响应的不同值。我怎样才能实现它?
$("#textbox1").keyup(function() {
$.get('state.jsp', {count : this.value}, function(responseData) {
$("#textbox2").val(responseData);//getting value in 2nd text box
$("#textbox3").val(responseData);// here also i am receiving same value as that 2nd textbox, how can i get a different value here?
});
});
<%
String firsttextbox=request.getParameter("count");
out.println(firsttextbox); //displayed in 2nd textbox plus it is also showing the below 3rdtextbox value, but i want to display out.println(firsttextbox); by 2nd textbox id only
String 3rdtextbox="3rd textbox value";
out.println(3rdtextbox); // it also displayed 3rdtextbox value plus it is also showing the 2nd textbox value
//How can i separate these two outputs so that `first println() will be displayed in 2nd textbox and 3rd println() will be displayed in 3rd text box?`
%>
任何帮助
答案 0 :(得分:1)
我不知道jsp编码,但做了类似的事情:
<%
String firsttextbox=request.getParameter("count");
String 3rdtextbox="3rd textbox value";
out.println(firsttextbox+'|'+3rdtextbox);// + for concatenation ?
%>
在你的js:
$("#textbox1").keyup(function() {
$.get('state.jsp', {count : this.value}, function(responseData) {
result=responseData.split('|');
$("#textbox2").val(result[0]);
$("#textbox3").val(result[1]);
});
});