Sunday, May 31, 2009

[jQuery] Form Plugin

Hey, I tried the form plugin, but I'm not getting the expected
complete event. Below is the code snippet. It's worth noting that
the data returned in JSON, not a HTML redirect. Any help would be
appreciated. Using Firebug, I can see the 'dom is ready' log, but not
the 'all done' log message.

Cheers

Robbie

<head>
<script type='text/javascript' src='jquery-1.3.2.min.js'></script>
<script type='text/javascript' src='jquery.form.js'></script>
<script type="text/javascript">
// wait for the DOM to be loaded
$(document).ready(function() {
console.log('dom is ready');
$('#myForm').ajaxForm(function() {
alert("Thank you for your comment!");
console.log('all done');
});
});
</script>
</head>
<body>


<form id='myform' action="http://mysite/account/picture"
enctype="multipart/form-data" method="post">
<fieldset class="common-form standard-form">
<input id="avatar" name="avatar" size="30" type="file" />
<p><small>Maximum size of 700k. JPG, PNG.</small></p>
<input name="commit" type="submit" value="Save" />
</fieldset>
</form>
</body>

No comments: