--- a/integration/v2/js/main.js Thu Jul 04 12:13:42 2013 +0200
+++ b/integration/v2/js/main.js Thu Jul 04 13:07:47 2013 +0200
@@ -53,12 +53,33 @@
$('.additemtocollection').bind('click', function(e){
// When an item meant to be added to a collection is clicked,
// we fill the form in the add-to-collection div
- console.log(this + ", " + $(this) + ", " + $(this).attr('data-type') + ", " + $(this).attr('data-id'));
$('#add-to-collection .item-type').val($(this).attr('data-type'));
$('#add-to-collection .item-id').val($(this).attr('data-id'));
});
+ $(".ajax-form").submit(function(e) { // On submit Ajax Form
+ var formel = $(this);
+ $.ajax({
+ url: formel.attr("action"),
+ type: formel.attr("method"),
+ data: formel.serialize(),
+ success: function(text) {
+ $('.popin-wrap').fadeIn(function(){
+ $(".additem-success").show();
+ });
+ //console.log("received : " + text);
+ $(".additem-success .collection-url").attr("href", text);
+ },
+ error: function() {
+ $('.popin-wrap').fadeIn(function(){
+ $(".additem-error").show();
+ });
+ }
+ });
+ formel.parents(".popin").hide();
+ return false;
+ });
if($('#map').length){
initmap()