3 Replies - 281 Views - Last Post: 15 April 2019 - 08:27 AM

#1 chrisjchrisj   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 76
  • Joined: 04-February 19

Help with error "Something went wrong. Please try again later"

Posted 14 April 2019 - 04:45 PM

I’m using this video web script where videos can be purchased to view.
Upon testing the purchasing process I see: “‘Something went wrong. Please try again later!!’,”

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) {
                    return swal(
                        'Error!',
                        'Not enough money',
                        'error'
                    );
                  }
           }
        }).fail(function() {
             swal(
                'Error!',
                'Something went wrong. Please try again later!!',
                'error'
            );
        })
    });
}

function buttonMultipleBuy(command) {
    var button = $("button[data-action='multuple-buy-video']");
    if (command == 'hide') {
        button.hide();
    } else if (command == 'show') {
        button.show();
    }
}




any help with resolving the error, to move to "Success" message, is appreciated

This post has been edited by chrisjchrisj: 14 April 2019 - 04:47 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Help with error "Something went wrong. Please try again later"

#2 andrewsw   User is offline

  • never lube your breaks
  • member icon

Reputation: 6798
  • View blog
  • Posts: 28,091
  • Joined: 12-December 12

Re: Help with error "Something went wrong. Please try again later"

Posted 14 April 2019 - 11:55 PM

jQuery's fail() provides some arguments, including errorThrown. Examine this to see if it contains useful information.

Also refer to your browser's developer tools; typically, using the Network tab (or similar).
Was This Post Helpful? 0
  • +
  • -

#3 chrisjchrisj   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 76
  • Joined: 04-February 19

Re: Help with error "Something went wrong. Please try again later"

Posted 15 April 2019 - 08:21 AM

Thanks for your message,
however, I didn't write this javascript and don't have a lot of knowledge with this code.
I don't know what to do with the info in your link. Any additional guidance on how to determine why I'm getting this error is appreciated
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15105
  • View blog
  • Posts: 60,391
  • Joined: 12-June 08

Re: Help with error "Something went wrong. Please try again later"

Posted 15 April 2019 - 08:27 AM

Search terms "jQuery ajax fail example" or "jQuery ajax fail tutorial".

Mind you 'fail' took over the job of 'error' in newer version of jquery.

Examples:
http://thisinterests...x-error-jquery/

While you didn't write that code chunk you should be able to piece together some error handling.. because right now no one is able to use that snippet to test anything on their end. :^:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1