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

The Archive Base Latest Questions

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

I currently write quite a bit of code in ASP.NET MVC and use jQuery

  • 0

I currently write quite a bit of code in ASP.NET MVC and use jQuery quite a bit also to make ajax calls to Actions that return json.

I’ve started to evolve this pattern where I make an object below my global object that contains a ‘success’ and ‘fail’ callback along with a ‘go’ method that invokes the core logic and takes arguments… as follows:

var g1 = {}; // global object for some project... 
g1.loadFileList = {
    success: function (data, status, request) {
         // notify success - or do nothing
    },
    fail: function (request, status, err) {
         // notify #FAIL!
    }, 
    go : function (args) {
        $.ajax({
            url: '/Home/SomethingInterest',
            type: 'POST', 
            success: this.success, 
            error: this.fail
        });
    }
};
$(document).ready(function() { g1.loadFileList.go({ whatever = 'data' }); });

I do this to keep my thoughts organized and I was about to start working on a slightly different pattern that I could start prototyping to reuse some of the logging I am doing in the error and success handlers, but then I thought… Is this in some other JS Fx???

Is it? Any thoughts on pre-existing frameworks that do similar things or thoughts on how to prototype this better is welcome.

  • 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-26T11:23:36+00:00Added an answer on May 26, 2026 at 11:23 am

    I’m going to chalk this up to. This is just a pattern that I use sometime to encapsulate the async call with its success and fail response handlers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently building an ASP.NET MVC project, with NHibernate as its persistance layer. For
I'm currently on my way to write a web application implementing the MVC and
I am currently converting a very old, but working classic ASP site to ASP.Net.
I am currently working in a .Net project but from university I have also
I wrote some code with a lot of recursion, that takes quite a bit
I am currently trying to write functional tests for a charging form which gets
I'm currently tempted to write the following: public class Class1() { public Class1() {
I am currently trying to write an addin for PowerPoint that whenever any PowerPoint
Currently I'm trying to write my first Python library and I've encountered the following
currently I am trying to write to an 20x4 LCD Dot-Matrix Module using Perle's

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.