Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1105169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:35:23+00:00 2026-05-17T01:35:23+00:00

when save() executes this.reset() or that.reset() it can’t find the reset() method and says

  • 0

when save() executes this.reset() or that.reset() it can’t find the reset() method and says it’s not a function. I used a workaround on init() to get it to work, but that method didn’t work in save()

var vehicle = function () {
    return {
        init: function () {
            var that = this;

            jQuery('.vehicle-year-profile .options .delete').bind('click', function (e) {
                e.preventDefault();
                that.remove(jQuery(e.currentTarget).parents('.vehicle-year-profile'));
            });

            jQuery('.vehicle-year-profile .options .edit').bind('click', function (e) {
                e.preventDefault();
                that.edit(jQuery(e.currentTarget).parents('.vehicle-year-profile').attr('id'));
            });

            jQuery('#association-detail .save').bind('click', function (e) {
                e.preventDefault();
                that.save();
            });
        },
        save: function () {
            var data = new Array();
            data['onSet'] = '';
            var onSet = jQuery('#association-detail input:checked');
            for (var i = 0; i < (onSet.length-1); i++) {
                data['onSet'] = data['onSet']+','+onSet.attr('id');
            }

            var priceSet = jQuery('#association-detail input[type=text]');
            for (var i = 0; i < (priceSet.length-1); i++) {
                data['priceSet'] = data['priceSet']+','+priceSet.attr('id')+':'+priceSet.val();
            }

            jQuery.ajax({
                type: 'post',
                url: '/ajax/store/product/saveAssocDetail.php',
                data: data,
                    success: function (r) {
                    if (r.length > 0) {
                        document.triggerNotification('check', 'Changes have been saved');
                        var that = this;
                        that.reset(); //ERROR IS TRIGGERED HERE
                    } else {
                        document.triggerNotification('x', 'Unable to save changes');
                    }
                    },
                error: function () {
                    document.triggerNotification('x', 'Unable to process your request, ajax file not found');
                    return false;
                }
            });
        },
        reset: function () {
            jQuery('#association-detail h3').html('');
            jQuery('#assocationVehicleId').val('');

            jQuery('#association-detail input:checked').attr('checked', false);
            jQuery('#association-detail input[type=text]').val('0.00');

            jQuery('#association-detail').hide();
        }
    }
}();
jQuery(function() {
    vehicle.init();
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:35:24+00:00Added an answer on May 17, 2026 at 1:35 am

    Perhaps it’s because you’ve made your reference to this inside your ajax call. Try putting this line:

    var that = this;
    

    before you make your ajax call, and then refer explicitly to that in your ajax call. So, something like:

    var that = this;
    
    jQuery.ajax({
        type: 'post',
        url: '/ajax/store/product/saveAssocDetail.php',
        data: data,
        success: function (r) {
            if (r.length > 0) {
                document.triggerNotification('check', 'Changes have been saved');
    
                /**
                * now you can refer to "that", which is in the proper scope
                */
    
                that.reset(); //ERROR IS TRIGGERED HERE
            } else {
                document.triggerNotification('x', 'Unable to save changes');
            }
        },
        error: function () {
            document.triggerNotification('x', 'Unable to process your request, ajax file not found');
            return false;
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Occasionally while attempting to save a Crystal Report that I'm working on in VS2008,
I need to save a user's login information in encrypted form for this application
Can someone please tell me where I'm going wrong with this piece of code?
I have a view that gets data from a form and executes a subprocess:
In my application i have a loop that executes about 1000 times, inside it
I save stuff in an Isolated Storage file (using class IsolatedStorageFile). It works well,
To save network traffic I'd like to compress my data. The only trick is
I would like to save the programs settings every time the user exits the
How do I save each sheet in an Excel workbook to separate CSV files
I want to save the objects I generated in a program. After restart the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.