开发者

concatenate with jquery

I'm trying to concatenate a string in a div with jQuery. Here is my code:

var server = 'server name: '
$('#div').load('myservername.aspx');

I'd like to display:

server n开发者_StackOverflow社区ame: myserver

How can I best achieve this?


Tweaking what you have

$('#div').load('myservername.aspx');
$('#div').prepend('Server Name:')

Could also do

$.get("myservername.aspx", function(data){

$('#div').html('Server name: ' + data)

});


jQuery manipulation docs have these little codes to append

$("p").append("<strong>Hello</strong>");


I'm assuming that you have an html with the following html code

<div id="some_id">
</div>

and you want to load the div with server name: myserver (?).

If so, i think you can use

$('#some_id').text("server name: myserver");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜