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 6100657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:24:43+00:00 2026-05-23T13:24:43+00:00

Ohey, I have a central function that runs AJAX requests throughout my order form.

  • 0

Ohey,

I have a central function that runs AJAX requests throughout my order form. I have default settings (essentially ajaxSetup, but I didn’t want to use that), and then each function passes in its own settings/parameters. * USING jQuery 1.6.1

Only issue is I’m using $.extend (neither deep extend nor normal works). It seems extending doesn’t carry along some of the functions. The weird thing is this worked once but now it doesnt and I can’t figure out why :|. The ajax request does run, but nothing happens on success… I call sendData in this instance with $.when(this.sendData(params, ‘snapshotCache’)).then(do stuff);

Here’s my code:

    this.sendData = function(options, cacheIndex) {

  var defaults = {
    url: this.dataPath + options.action,
    data: 'qs=NULL',
    type: 'POST',
    dataType: 'text/html', //(THIS SHOULD HAVE BEEN just 'text')
    success: function(result, textStatus, xhr) {
      console.log(cacheIndex)
      console.log('HELLO')
      if(typeof cacheIndex !== 'undefined') {
        var qs = settings.data;
        cacheObj.cacheAdd(qs, cacheIndex, result);
        alert(cacheObj);
      }
    },
    error: function(xhr, textStatus, errorThrown) {
      if(textStatus === 'timeout') {
         $.ajax(this); // retry
         return;
       } else if(errorThrown === 500) {
        alert(ERROR['500Msg']);
       }
    }
  };
  var settings = $.extend(true, defaults, options);
  return $.ajax(settings);
};

Here’s what is in the object settings before I return:

url => /order/getsnapshot
data => micro=img%2Fstore%2Fcomp-08.png%2Cimg%2Fstore%2Fcomp-08n.png%2Cimg%2Fstore%2Fcomp-08t.png%2Cimg%2Fstore%2Fcomp-08a.png%2Cimg%2Fstore%2Fcomp-08l.png%2Cimg%2Fstore%2Fcomp-08h.png&outPath=1242353103103.png
type => POST
dataType => text/html
success => function (result, textStatus, xhr) { console.log(cacheIndex); console.log("HELLO"); if (typeof cacheIndex !== "undefined") { var qs = settings.data; alert(cacheObj); } }
error => function (xhr, textStatus, errorThrown) { if (textStatus === "timeout") { $.ajax(this); return; } else if (errorThrown === 500) { alert(ERROR['500Msg']); } }
action => getsnapshot
cache => true
  • 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-23T13:24:43+00:00Added an answer on May 23, 2026 at 1:24 pm

    Calling $.when() is not needed. Below is sufficient:

    this.sendData(params, 'snapshotCache')).done(function(){ ... });
    

    Keep in mind with the new deferreds, done() is like success and fail() is like error.

    Also, I would just do this for your settings objects:

    var settings = {};
    $.extend(true, settings, defaults, options);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am running trying to run two sub routines at once in perl. What

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.