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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:27:12+00:00 2026-06-09T15:27:12+00:00

Im trying to use if else statement in success ajax function, but the value

  • 0

Im trying to use if else statement in success ajax function, but the value always false and data inserted
I use jQuery v1.7.1, here my code

// Contact Submiting form
function Contact_form(form, options){       
    $.ajax({
        url: 'contact.php',
        data: $('#contactform').serialize(),
        success: function(data){    
              if(data.check == '1'){ // if Ajax respone data.check =1 or Complete
                 $('.notifications').slideDown(function(){
                            setTimeout("$('.notifications').slideUp();",7000);                              
                        }); // Show  notifications box
                 $('#contactform').get(0).reset();  //  reset form

              }
              else if(data.check == '0'){ 
                  $('#preloader').fadeOut(400,function(){ $(this).remove(); });     
                  alert("No complete");
                  return false;
              }

        },
        cache: false,type: 'POST',dataType: 'json'
    });
}
  • 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-06-09T15:27:14+00:00Added an answer on June 9, 2026 at 3:27 pm

    if else is bad in success function use

    function Contact_form(form, options){       
        $.ajax({
            url: 'contact.php',
            data: $('#contactform').serialize(),
            success: function(data){
                     $('.notifications').slideDown(function(){
                            setTimeout("$('.notifications').slideUp();",7000);                              
                        }); // Show  notifications box
                     $('#contactform').get(0).reset();  //  reset form
                        unloading();     //  remove loading
            },
            error: function(data){  
                  $('#preloader').fadeOut(400,function(){ $(this).remove(); });     
                                alert("No complete");
                    return false;
            },
            cache: false,type: 'POST',dataType: 'json'
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am need paint my image. I'm trying use JQuery in here this link:
I'm trying to use this statement: @vote = Vote.where(:resource_id => params[:id], :user_id => current_user.id).first_or_create(:value
I'm trying use preg_match in an IF statement and return false if a string
I didn't know what else to use in this case but an if statement.
I am trying to use ajax to update the views which simply checking results
I'm trying to achieve a cross-browser if/else statement. The issue is I'm checking the
So I'm trying to use a sorting function (similar to bubble) and pass into
Trying to use a case statement to control the operation of limit. Sample query
I am trying to use an 'if' statement to determine which element was clicked.
I am trying to use variables in my mysql statement so they will change

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.