UPDATE: I moved this question over to Stack Overflow.
So I have a basic comment form hooked up with the jQuery Form plugin (only members can post so no name/email fields):
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
{!-- Script tags Linking to jQuery 1.7.2 and the jQuery Form plugin --}
[removed][removed]
[removed][removed]
[removed]
$(document).ready(function(){
function ajaxReturn(data) {
var messageContainer = $('.alert-box');
var messageBody = $(data);
messageContainer.html(messageBody);
}// ajaxReturn(data)
$('.member-review').ajaxForm({
success: ajaxReturn
});
});
[removed]
</head>
<body>
{exp:channel:entries
channel='products'
limit='1'
disable='categories|member_data|pagination'
}
{exp:comment:form
channel='products'
form_class='member-review'
return='notifications/success'
}
<div class="alert-box">
{!-- Ajax Form Errors --}
</div><!--.alert-box-->
<label for="comment">Tell others what you think</label>
<textarea name="comment" rows="8" class="required" id="comment"></textarea>
<input type="submit" value="Submit">
{/exp:comment:form}
{/exp:channel:entries}
</body>
</html>And, for the purposes of this demo, my success template could not be more simple:
Sumission Successful!Unfortunately when I submit a completed form, no data is returned. If I add
console.log〈$(data〉);to the ajaxReturn function, I get an empty string. The comment is successfully submitted to the database, it’s just the return template that doesn’t seem to make it.
Really not sure why this is happening. It returns error messages correctly, just not the success template.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.