How to include a page onclick on the client side
Posted 2007-11-03 in JavaScript by Johann.
Here’s a simple example on how to include another page on the clientside using the inc clientside include plugin:
<div id="bla"></div> <p onclick="$('#bla').inc('blob.txt')">Include stuff</p>
I’m using the onclick
event handler here but you could use javascript:
-URIs like <a href="javascript:">
as well.
Clientside includes have some limitations.
- You can only include resources from the current domain (or sub-domain).
- Mozilla-based browsers seem to only load content with MIME types
text/*
though I have to look this up.
Demo
Click here to include my robots.txt
.
Subscribe
RSS 2.0, Atom or subscribe by Email.
Top Posts
- DynaCloud - a dynamic JavaScript tag/keyword cloud with jQuery
- 6 fast jQuery Tips: More basic Snippets
- xslt.js version 3.2 released
- xslt.js version 3.0 released XML XSLT now with jQuery plugin
- Forum Scanners - prevent forum abuse
- Automate JavaScript compression with YUI Compressor and /packer/