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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:00:33+00:00 2026-05-28T01:00:33+00:00

Hi there folks I have a jquery script to submit a form and if

  • 0

Hi there folks I have a jquery script to submit a form and if successful it sends json output back.

function subscribe(email, city){
    var email = $('input#email').val();
    var city = $('select#citySelect').val();

    $.ajax({
        url: 'http://www.amazingvouchercodes.co.uk/avc_dev/subscribe/subscribeTo',
        type: 'post',
        data: 'email='+email+'&city='+city,
        dataType: 'json',
        success: function(json){
            window.location.href = json['url'];
            $('#notifications').append('<div class="success">'+json['success']+'</div>');
        }
    }); 
}

the problem I have is that it is displaying the notification > json success before the redirect after redirect the notification doesnt show, is there a way to show the notification after the redirect?

Thanks all help is appreciated 🙂

Joe

  • 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-28T01:00:34+00:00Added an answer on May 28, 2026 at 1:00 am

    Like AlienWebguy suggested,

    It is because you are loading a new page, so any JavaScript gets reset.

    I think the best way would be to have an element set in your layout/header that displays messages on the top of your screen (like how this site notifies you of something in the orange bar) if any are pending. So on your Ajax page, you set a notification (session/cookie) variable. Then the next time a page loads (after your redirect), the layout will know there is a notification pending, it displays it in the layout/header and clears it (so it only shows up once.)

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

Sidebar

Related Questions

Folks, I have a feeling there's a classic design pattern that covers this case,
Hey folks... I am back with another issue... I am using jquery Autocomplete on
Other folks have asked about using SQL and NoSQL together, and subsequently whether there's
Hio there Scala folks, I'm actually writing my master thesis and I have to
Folks, is there a collection of gotchas where Numpy differs from python, points that
There are numerous Agile software development methods. Which ones have you used in practice
Ok fine folks of Stack Overflow, I have a question and I can't seem
I have created some JQuery that on click of specified HTML it then becomes
I'm hoping to hear from a cross-section of folks who have SharePoint installed at
Folks, I am completely new to jQuery and JqGrid both. Usually I take some

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.