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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:04:06+00:00 2026-05-25T16:04:06+00:00

Ok, this seems ridiculous and I know WHY this is happening technically, but there

  • 0

Ok, this seems ridiculous and I know WHY this is happening technically, but there has to be a way around it!

The issue is as follows:

I have a javascript object that, after being created, you can call a method on and it submits an ajax request and them returns false. The code for the object is in another file.

Here is the object:

function AjaxHandler(groupid, typeid, currentLocation, controllerUrl) {
  this.groupId = groupid || 0;
  this.typeId = typeid || 0;
  this.href = currentLocation || '';
  this.method = controllerUrl;
}

AjaxHandler.prototype.Submit = function () {
  var queryString = this.href.split('?')[1];
  var newHref = this.method;

  if (queryString != null && queryString != undefined)
    newHref = newHref + "?" + queryString

  $.ajax({
    type: "post",
    url: newHref,
    contentType: "application/x-www-form-urlencoded",
    error: function (xhr, type, exception) {
      console.log("Error occurred in AjaxHandler.Submit. Type: " + type + " Exception: " + exception);
    }
  });

  return false;
};

I call this method in a script block on the Index page. It is called in a jquery ‘live’ which is set up during .ready . Here is the .ready code:

$(document).ready(function () {
    SetShowMoreResultsFeatures();

    $(".tabs a").live('click', function (e) {
      var href = $(this).attr('href');
      var queryString = href.split('?')[1];
      var queryStringValue = '';

      if (queryString != null)
        queryStringValue = queryString.split('=')[1];

      var tabHandler = new AjaxHandler(null, queryStringValue, href, '/home/GetCasesByType');
      tabHandler.Submit();

      //return false;
    });

  });

As you can see, the ‘return false’ in the above code is commented out and there is a return false that occurs in the ‘AjaxHandler’ object. If I comment out the one in the object and uncomment the one in ‘ready’ the page does not flash and everything is fine. If I leave it the way that it is then the page flashes.

I have researched this and, while people have similar issues, it seems to be all surrounding the ajax call directly in the ‘live’ setup.

Any insight as to how to make this work properly. This object is supposed to be generic enough to use in any instance where ajax is needed for our tab structure so keeping the ‘return false’ in the method call instead of the ‘live’ is important.

  • 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-25T16:04:06+00:00Added an answer on May 25, 2026 at 4:04 pm

    Rather than returning false I’d recomend using the propper jQuery method for this.

    In your case here it’s

    e.preventDefault();
    

    If you were to stick with using your aformentioned code, you wouldn’t need to return false in both methods but you would need to return false in the final method.

    What I’d do in that case is return the result of the call to submit.

    return tabHandler.Submit(); // which is returning false
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This seems like such a simple issue but I cannot find an elegant solution.
To a person skilled in programming, I know this question might seem ridiculous, but
This may be a ridiculous question, but it seems like a reasonable one to
This seems like such a ridiculous question, but our intranet portal which hosts hundreds
This seems ridiculous but I can't seem to sort it out. I need to
This one seems to be quite ridiculous but how can I open a VS
This seems a 'stupid' question, but let me explain. I'm working for a company
This seems like a repeated question but i'm not able to get my answer.
This seems to be primary Question. but i search it and i couldn't find
This seems to make perfect sense, but it is not working. I seem to

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.