Bug 592000, email sharing is all ajaxified now. also, fixed validation

This commit is contained in:
Matt Claypotch 2010-09-01 16:34:19 -07:00
Родитель ddce11cd4f
Коммит 6483d54df0
2 изменённых файлов: 19 добавлений и 2 удалений

Просмотреть файл

@ -37,7 +37,7 @@
<span class="optional">{{ _('(optional)') }}</span>
</label>
<textarea id="FriendMessage" name="data[Friend][message]"></textarea>
</pv>
</p>
<p class="container emailerror" style="display:none">
<p></p>
</p>

Просмотреть файл

@ -755,7 +755,24 @@ $(document).ready(function () {
$(".share-networks", $popup).show();
$(".share-email", $popup).hide();
});
$(".share-email form", $popup).attr("action", base_url + 'email');
$(".share-email form", $popup).submit(function(e) {
e.preventDefault();
var form_data = $(this).serialize();
$.post(base_url + 'email', form_data, function(d) {
if (d.success) {
$(".share-email-success", $popup).show();
setTimeout(function() {
$(".share-networks", $popup).show();
$(".share-email", $popup).hide();
$popup.hide();
}, 800);
} else if (d.error) {
$(".emailerror", $popup).text(d.error);
} else {
$(".emailerror", $popup).text(gettext('Oh no! Please try again later.'));
}
});
});
}
if (counts) {
for (s in counts) {