Custom ajax request with overlay-on-ajax extension

Notice: This thread is very old.
wise
Member | 161
+
0
-

Hi guys,

I`m using this extension: https://gist.github.com/…6b705023c0a4

At the beginning is this part:

$.nette.ext('overlay-on-ajax', {
		before: function (xhr, settings) {

			if (!settings.nette || !settings.nette.el) {
				return;
			}

when I have <a class="ajax"..> and checked the settings parameters, it contains settings.nette and settings.nette.el.

I want to send custom ajax request, like:

$(document).on('click', 'a[data-parameter]', function (event) {
		e.preventDefault();

		$.nette.ajax({
			url: url,
			data: data,
		}, this, event); // <-- problem
});

When I add that third event parameter, ajax request is cancelled.

What should I do to process ajax request and catch 'a[data-parameter]' at overlay-on-ajax extension?

If I remove event parameter at my custom $.nette.ajax, ajax is successful, but settings.nette is undefined.

Everything what I want is to have an access to a[data-parameter] at overlay-on-ajax extension :)

Thanks a lot!

@VojtěchDobeš

Last edited by wise (2015-12-15 17:28)

silviustan
Member | 22
+
+1
-

Hi wise,

At first look you may have an error because using e.preventDefault();
Try event.preventDefault(); because “e” is undefined.