Reputation: 12740
When I click Show Contact link below, it should read the file from local disk and print its content. My example below prints [object XMLDocument] instead of actual content of the file.
Do I have to parse or convert it before printing?
Thanks
<script type="text/javascript">
function show_contact()
{
jQuery.get('file:///D:/contact.html', function(data)
{
document.getElementById('content').innerHTML = data;
});
}
</script>
<a href="#" title="" onclick="show_contact()">Show Contact</a>
<br />
<p id="content">hi</p>
Upvotes: 1
Views: 1310
Reputation: 1722
Pass the dataType as the third parameter:
jQuery.get('file:///D:/contact.html', function(data)
{
document.getElementById('content').innerHTML = data;
}, 'text');
Upvotes: 4