FavoriteLoadingAdd to favorites

In the Ajax submits you will see a variable. formdata
The below snippet is what you must append to the top of your Ajax call to initiate the variable
Otherwise you need to change the variable to what ever you are targeting.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
var formdata = new FormData;
formdata.append("commId", $("#template-id").val());
var formdata = new FormData; formdata.append("commId", $("#template-id").val());
var formdata = new FormData;
formdata.append("commId", $("#template-id").val());
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$("#product-form").on('submit', function(e) {
e.preventDefault();
$.ajax({
type: 'POST',
url: 'strategy/create-product',
data: new FormData(this),
contentType: false,
dataType: 'json',
cache: false,
processData: false,
success: function(response) {
if (response.success) {
location.href = "product/index"
} else {
PNotify.error({
title: 'Error Saving Product',
text: response.message,
mode: 'light'
});
}
}
});
});
$("#product-form").on('submit', function(e) { e.preventDefault(); $.ajax({ type: 'POST', url: 'strategy/create-product', data: new FormData(this), contentType: false, dataType: 'json', cache: false, processData: false, success: function(response) { if (response.success) { location.href = "product/index" } else { PNotify.error({ title: 'Error Saving Product', text: response.message, mode: 'light' }); } } }); });
    $("#product-form").on('submit', function(e) {
        e.preventDefault();
        $.ajax({
            type: 'POST',
            url: 'strategy/create-product',
            data: new FormData(this),
            contentType: false,
            dataType: 'json',
            cache: false,
            processData: false,
            success: function(response) {
                if (response.success) {
                    location.href = "product/index"
                } else {
                    PNotify.error({
                        title: 'Error Saving Product',
                        text: response.message,
                        mode: 'light'
                    });
                }
            }
        });
    });
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$.ajax({
type: 'POST',
url: 'products/save-email-template',
dataType: 'json',
data: formdata,
processData: false,
cache: false,
contentType: false,
success: function (response) {
if (response.success) {
PNotify.success({
title: 'Success!',
text: response.message,
styling: 'material',
mode: 'light',
maxTextHeight: null,
delay: 2000,
destroy: true,
closer: true,
sticker: false
});
setTimeout(() => {
location.reload();
}, 500);
} else {
PNotify.error({
title: 'Error!',
text: response.message,
styling: 'material',
mode: 'light',
maxTextHeight: null,
delay: 2000,
destroy: true,
closer: true,
sticker: false
});
}
}
});
$.ajax({ type: 'POST', url: 'products/save-email-template', dataType: 'json', data: formdata, processData: false, cache: false, contentType: false, success: function (response) { if (response.success) { PNotify.success({ title: 'Success!', text: response.message, styling: 'material', mode: 'light', maxTextHeight: null, delay: 2000, destroy: true, closer: true, sticker: false }); setTimeout(() => { location.reload(); }, 500); } else { PNotify.error({ title: 'Error!', text: response.message, styling: 'material', mode: 'light', maxTextHeight: null, delay: 2000, destroy: true, closer: true, sticker: false }); } } });
        $.ajax({
            type: 'POST',
            url: 'products/save-email-template',
            dataType: 'json',
            data: formdata,
            processData: false,
            cache: false,
            contentType: false,
            success: function (response) {
                if (response.success) {
                    PNotify.success({
                        title: 'Success!',
                        text: response.message,
                        styling: 'material',
                        mode: 'light',
                        maxTextHeight: null,
                        delay: 2000,
                        destroy: true,
                        closer: true,
                        sticker: false
                    });
                    setTimeout(() => {
                        location.reload();
                    }, 500);
                } else {
                    PNotify.error({
                        title: 'Error!',
                        text: response.message,
                        styling: 'material',
                        mode: 'light',
                        maxTextHeight: null,
                        delay: 2000,
                        destroy: true,
                        closer: true,
                        sticker: false
                    });
                }
            }
        });

Pin It on Pinterest

Garth Baker
Favorite
Loading
en
af
sq
am
ar
hy
az
eu
be
bn
bs
bg
ca
ceb
ny
zh-CN
zh-TW
co
hr
cs
da
nl
en
eo
et
tl
fi
fr
fy
gl
ka
de
el
gu
ht
ha
haw
iw
hi
hmn
hu
is
ig
id
ga
it
ja
jw
kn
kk
km
ko
ku
ky
lo
la
lv
lt
lb
mk
mg
ms
ml
mt
mi
mr
mn
my
ne
no
ps
fa
pl
pt
pa
ro
ru
sm
gd
sr
st
sn
sd
si
sk
sl
so
es
su
sw
sv
tg
ta
te
th
tr
uk
ur
uz
vi
cy
xh
yi
yo
zu
Share This