I’m using this video web script where videos can be purchased to view.
There are a couple of error messages in the code. I added ‘One’ and ‘Two’ at the end of each error message, just to see which error message was displaying upon Proceeding with a purchase, and upon testing it is always “‘Something went wrong. Please try again later!One’,” hoping to narrow down what the issue is, but it’s beyond my troubleshooting knowledge.
Any help or guidance on what to check or look at, or if you need me to provide more code to view, to resolve this issue in order to proceed with purchase test, will be appreciated:
function PT_MultipleBuyVideo() {
var checked = getSelectedVideos();
if (!checked) { return false; }
swal({
title: "",
type: "info",
html:"Simply proceed to purchase " + countSelectedVideos() + " videos(s) at a total cost of " + countTotalCredits() +" credits",
showCancelButton: true,
cancelButtonText: "Close",
customClass: 'sweetalert-lg',
confirmButtonText:'Proceed'
}).then(function(){
$.ajax({
url: PT_Ajax_Requests_File() + 'aj/buy-video',
type: 'POST',
dataType: 'json',
data: {id:checked},
}).done(function(data){
if (data.status == 200) {
for (var i = 0; i < checked.length; i++) {
var button = $("button[data-action='multiple_select_button'][data-id='" + checked[i] + "']")
buttonMultipleSelectingStyle(button, 'purchased');
}
swal({
title: "Success",
type: "success",
html:"",
showCancelButton: true,
cancelButtonText: "Close",
customClass: 'sweetalert-lg',
confirmButtonText:'Go To Video(s)'
}).then(function(){
window.location.href='/paid-list';
});
} else {
if (data.error_num == 1) {
swal(
'Error!',
'Not enough money',
'error'
);
} else {
swal(
'Error!',
'Something went wrong. Please try again later!One',
'error'
);
}
}
}).fail(function() {
swal(
'Error!',
'Something went wrong. Please try again later!Two',
'error'
);
})
});
}
function buttonMultipleBuy(command) {
var button = $("button[data-action='multuple-buy-video']");
if (command == 'hide') {
button.hide();
} else if (command == 'show') {
button.show();
}
}