Forum Moderators: open
<script type="text/javascript">
$(document).ready(function() {
$('.htmlForm').ajaxForm({
target: '#target2',
success: function() {
$('#target2').fadeIn('slow');
}
});
});
</script>
<script type="text/javascript">
$(document).ready(function() {
var target = $('#target').val();
$('.htmlForm').ajaxForm({
target: target,
success: function() {
$(target).fadeIn('slow');
}
});
});
</script>
<form class="htmlForm" action="ajax-data.php" method="post">
<input type="hidden" id="target" value="target2">
Message: <input type="text" name="message" value="Hello HTML" />
<input type="submit" value="Echo as HTML" />
</form>
<div id="target2">div id=target2</div>
<script type="text/javascript">
$(document).ready(function() {
$('.htmlForm').ajaxForm({
target: target,
delegation: true,
success: function() {
$(target).fadeIn('slow');
}
});
});
</script>
</head><body>
<form class="htmlForm" action="ajax-data.php" method="post">
<input type="hidden" name="target" value="z22" />
Message: <input type="text" name="message" value="Hello HTML" />
<input type="submit" value="Echo as HTML" />
</form>
<div id="target">div id=target</div>
<div id="z22">div id=z22</div>
$(document).ready(function() {
var target = $('#target').val();
// Make sure target is a valid id selector (starts with #)
target = (target.indexOf('#') === 0? target : '#' + target);
$('.htmlForm').ajaxForm({
target: target,
success: function() {
$(target).fadeIn('slow');
}
});
});