Combine with jquery

I am trying to concatenate a string to a div using jQuery. Here is my code:

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

      

I would like to display:

server name: myserver

How can I achieve this?

+2


source to share


3 answers


Customizing what you have

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

      



You can also do

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

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

});

      

+13


source


jQuery manipulation documents have these little codes to add



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

      

0


source


I assume you have html with the following html code

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

      

and you want to load a div named server: myserver (?).

If so I think you can use

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

      

-1


source







All Articles