Skip to content

Commit ed2b2cb

Browse files
committed
Merge pull request #155 from arunpjohny/master
Add ajax option to the nmObject
2 parents 29ef228 + e34a539 commit ed2b2cb

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

js/jquery.nyroModal.filters.form.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,26 @@ jQuery(function($, undefined) {
2424
});
2525
},
2626
load: function(nm) {
27-
var data = nm.opener.serializeArray();
27+
var data = {};
28+
$.map(nm.opener.serializeArray(), function(d){
29+
data[d.name] = d.value;
30+
});
2831
if (nm.store.form.sel)
29-
data.push({name: nm.selIndicator, value: nm.store.form.sel.substring(1)});
30-
$.ajax({
32+
data[nm.selIndicator] = nm.store.form.sel.substring(1);
33+
34+
var ajax = $.extend(true, { type : 'get', dataType : 'text' }, nm.ajax || {}, {
3135
url: nm.store.form.url,
3236
data: data,
33-
type: nm.opener.attr('method') ? nm.opener.attr('method') : 'get',
37+
type: nm.opener.attr('method') ? nm.opener.attr('method') : undefined,
3438
success: function(data) {
3539
nm._setCont(data, nm.store.form.sel);
3640
},
3741
error: function() {
3842
nm._error();
3943
}
4044
});
45+
46+
$.ajax(ajax);
4147
}
4248
}
4349
});

js/jquery.nyroModal.filters.link.js

+12-10
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,18 @@ jQuery(function($, undefined) {
2424
});
2525
},
2626
load: function(nm) {
27-
$.ajax({
28-
url: nm.store.link.url,
29-
data: nm.store.link.sel ? [{name: nm.selIndicator, value: nm.store.link.sel.substring(1)}] : undefined,
30-
success: function(data) {
31-
nm._setCont(data, nm.store.link.sel);
32-
},
33-
error: function() {
34-
nm._error();
35-
}
36-
});
27+
var ajax = $.extend(true, {}, nm.ajax || {}, {
28+
url: nm.store.link.url,
29+
data: nm.store.link.sel ? [{name: nm.selIndicator, value: nm.store.link.sel.substring(1)}] : undefined,
30+
success: function(data) {
31+
nm._setCont(data, nm.store.link.sel);
32+
},
33+
error: function() {
34+
nm._error();
35+
}
36+
});
37+
38+
$.ajax(ajax);
3739
}
3840
}
3941
});

0 commit comments

Comments
 (0)