I have this JQuery function:
function addSomeHTML()
{
$("#mysection").html("<div id='myid'>some content here</div>");
}
I basically need this part: <div id='myid'>some content here</div>
to be read from an external file.
Can anyone help please?
Thanks
I have this JQuery function:
function addSomeHTML()
{
$("#mysection").html("<div id='myid'>some content here</div>");
}
I basically need this part: <div id='myid'>some content here</div>
to be read from an external file.
Can anyone help please?
Thanks
Share Improve this question asked Apr 17, 2011 at 22:23 Satch3000Satch3000 49.5k90 gold badges225 silver badges349 bronze badges1 Answer
Reset to default 5Use the AJAX load()
method.
$('#mysection').load('yourfile.html');
Of course the URL can also point to a PHP script etc.