英文:
Javascript - Insert hyperlink in a dynamic text which is formed in javascript,and on click, it should hit a servlet
问题
<div id="myDiv"></div>
Javascript代码:
在Ajax调用成功时:
success: function(resp) {
var currentText = $("#myDiv").html();
$("#myDiv").html(currentText + "Case : " + textWithLink + " Done<BR/>");
}
我想在textWithLink
中插入一个超链接,点击后应该访问一个servlet,比如说myServlet
。
我当前得到的输出是:
Case ABCDEF Done
Case BHRTYU Done
我希望在ABCDEF和BHRTYU中插入超链接。
谢谢
英文:
I have a javascript function, which has an ajax call, and on success of that call, I am appending a htm text in a div, with a dynamic variable. I want to insert a hyperlink in that dynamic variable, and on click of that hyperlink, it should hit a servlet.
<div id="myDiv"></div>
Javascript code :
On success of Ajax call :
success: function(resp) {
var currentText = $("#myDiv").html();
$("#myDiv").html(currentText + "Case : " + textWithLink+ " Done<BR/>");
}
I want to insert a hyperlink in 'textWithLink' and on click it should hit a servlet, say 'myServlet'.
The current output that I am getting is :
Case ABCDEF Done
Case BHRTYU Done
I want to insert hyperlink in ABCDEF and BHRTYU.
Thanks
专注分享java语言的经验与见解,让所有开发者获益!
评论