Permalink
Browse files

Merge pull request #155 from arunpjohny/master

Add ajax option to the nmObject
  • Loading branch information...
2 parents 29ef228 + e34a539 commit ed2b2cbc72e1e96bcf83e34efe1bb8c6bfe3bd0d @nyroDev committed Jan 19, 2012
Showing with 22 additions and 14 deletions.
  1. +10 −4 js/jquery.nyroModal.filters.form.js
  2. +12 −10 js/jquery.nyroModal.filters.link.js
@@ -24,20 +24,26 @@ jQuery(function($, undefined) {
});
},
load: function(nm) {
- var data = nm.opener.serializeArray();
+ var data = {};
+ $.map(nm.opener.serializeArray(), function(d){
+ data[d.name] = d.value;
+ });
if (nm.store.form.sel)
- data.push({name: nm.selIndicator, value: nm.store.form.sel.substring(1)});
- $.ajax({
+ data[nm.selIndicator] = nm.store.form.sel.substring(1);
+
+ var ajax = $.extend(true, { type : 'get', dataType : 'text' }, nm.ajax || {}, {
url: nm.store.form.url,
data: data,
- type: nm.opener.attr('method') ? nm.opener.attr('method') : 'get',
+ type: nm.opener.attr('method') ? nm.opener.attr('method') : undefined,
success: function(data) {
nm._setCont(data, nm.store.form.sel);
},
error: function() {
nm._error();
}
});
+
+ $.ajax(ajax);
}
}
});
@@ -24,16 +24,18 @@ jQuery(function($, undefined) {
});
},
load: function(nm) {
- $.ajax({
- url: nm.store.link.url,
- data: nm.store.link.sel ? [{name: nm.selIndicator, value: nm.store.link.sel.substring(1)}] : undefined,
- success: function(data) {
- nm._setCont(data, nm.store.link.sel);
- },
- error: function() {
- nm._error();
- }
- });
+ var ajax = $.extend(true, {}, nm.ajax || {}, {
+ url: nm.store.link.url,
+ data: nm.store.link.sel ? [{name: nm.selIndicator, value: nm.store.link.sel.substring(1)}] : undefined,
+ success: function(data) {
+ nm._setCont(data, nm.store.link.sel);
+ },
+ error: function() {
+ nm._error();
+ }
+ });
+
+ $.ajax(ajax);
}
}
});

0 comments on commit ed2b2cb

Please sign in to comment.