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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:15:26+00:00 2026-05-24T05:15:26+00:00

I have a JQuery Function (function ($) { jQuery.fn.saveUser = function(destinationUrl) { this.click(function() {

  • 0

I have a JQuery Function

(function ($) {
jQuery.fn.saveUser = function(destinationUrl) {
    this.click(function() {
        var formData = 'option=saveuser&'+$('form#save-user').serialize();
        $.ajax({
            type: 'POST',
            url:  'process.php',
            data: formData,
            success: function(msg){
                if(msg === 'empty') {
                    alert('Required Values Missing');
                } else if(msg === 'duplicateEmail'){
                    alert('Email already exist');
                } else {
                    window.location = destinationUrl;
                }
            }
        });
    });
}

now based on some actions and events, i redirect it to different pages, in this case i need it to redirect it to two different url.

1) reload the same page preserving all $_GET variables via URI

2) reload to the specified url.

the below jQuery code can redirect me to any specific url.

$('form#save-user button[name="save-user-close"]').saveUser(function() {
    return 'index.php?users';
});

however i am not getting how do i make it redirect to the same page for example.

$('form#save-user button[name="save-user-close"]').saveUser(function() {
    return location.reload(true);
});

i know the above code will not work, i am confused on how do i go with this?

  • 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-24T05:15:26+00:00Added an answer on May 24, 2026 at 5:15 am

    You are never calling the function in your code, so it would not work whatever you put in the function. Intead of:

    window.location = destinationUrl;
    

    you should call the function, and let the function do the redirection:

    destinationUrl();
    

    (And you probably want to rename the parameter to reflect the change of usage.)

    So your functions should do the redirection instead of returning the URL, so that you can use the reload method in the second one:

    $('form#save-user button[name="save-user-close"]').saveUser(function() {
      window.location = 'index.php?users';
    });
    

    and:

    $('form#save-user button[name="save-user-close"]').saveUser(function(e) {
      location.reload(true);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following jquery code: jQuery(function(){ jQuery(select#rooms).change(function(){ var options = ''; jQuery.getJSON(/admin/selection.php,{id: jQuery(this).val(),
I have this jQuery function: $('#invite_friends_email').live('click' , function() { $(#invite_friends_email).dialog(); return false; }); and
I have some jQuery function: rfx.jQuery(function(){ rfx.jQuery(.form-row.errors).blur(some_function(this)) }); But 'this' is HTMLDocument and not
I have a jquery function whichh looks like this: <script type=text/javascript> $(document).ready(function() { $('a#id').click(function(e){
I have jquery function: function handleSplittingPrices() { var customerId = $(this).val(); loadSplittingPrices(customerId); } I
I have this jQuery function : $('a[name=pmRead]').click(function(e) { e.preventDefault(); $(this).parents(.pmMain).find(.pmMain5).toggle(); $.ajax({ type: 'POST', cache:
I have a jquery function like this: $(function() var ticker = function() { setTimeout(function(){
I have this jQuery simple code: <script type=text/javascript> <!-- jQuery(function(){ jQuery('#old_thumb').click(function(){ $(this).val($(this).attr('title')); $('#sf').val('2'); $('#add_new_event').submit();
I have jquery function that is triggered by a 'click' handler: $('#showDatesCheckbox').click(function(){ var table
I have a jquery function like this: (function($){ $.fn.myjqfunction = function(cfg){ var foo1, foo2;

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.