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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:30:43+00:00 2026-06-16T23:30:43+00:00

I have the following code: function check_email() { var email = $(‘#email’).val(); $.post( inc/check.php,

  • 0

I have the following code:

function check_email() {
    var email = $('#email').val();
    $.post(
        "inc/check.php", 
        { email: email },
        function(result) {
            if (result == 0) {
                // Do Stuff
            }
            else {
                // Do Stuff
            }
        }
    );
}

In my browser in the development environment this tests fine. However in other environments with the same browser the request does not seem to fire. I tested this by doing the following:

function check_email() {
    alert('test1');
    var email = $('#email').val();
    $.post(
        "inc/check.php", 
        { email: email }, 
        function(result) {
            alert('test2');
            if (result == 0) {
                // Do Stuff
            }
            else {
                // Do Stuff
            }
        }
    );
}

The first test1 alert fires but the second alert test2 doesn’t. Remember this is only in certain environments. Has anybody got any ideas why?

  • 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-16T23:30:44+00:00Added an answer on June 16, 2026 at 11:30 pm

    The first test1 alert fires but the second alert test2 doesn’t. Remember this is only in certain environments. Has anybody got any ideas why?

    Because something is going wrong in the environments where it doesn’t work, and so the success handler isn’t getting called.

    You can find out what went wrong by

    1. Looking at your browser’s development tools, and in particular the network tab, and

    2. Using the error handler and inspecting the information it gives you.

    Option #2 will require rewriting your $.post using $.ajax (it’s just a shortcut/wrapper around $.ajax anyway), like this:

    $.ajax({
        type:    'POST',
        url:     "inc/check.php",
        data:    {email: email},
        success: function(result) {
            alert('test2');
            if (result == 0) {
                // Do Stuff
            }
            else {
                // Do Stuff
            }
        },
        error:   function(jqXHR, status, errThrown) {
            // Look at what went wrong here
        }
    });
    

    As a side note, alert-style debugging is incredibly inefficient, and there’s no need for it in 2013. Instead, use the debugger built into your browser. Set breakpoints and step through the code. All major browsers have a debugger built in, including IE8 and above. Firefox’s built-in one is still fairly basic, but there’s the Firebug plug-in. The tools built into Chrome are excellent, but again, they all have them to a greater or lesser degree. There’s even Visual Studio if you absolutely, positively have to debug something on IE7 or IE6.

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

Sidebar

Related Questions

I have the following code $('#check-twitter').click( function() { if ($('#ShareTwitterPublish').val() == '0') { $('#ShareTwitterPublish').val('1');
I have the following code: function show(){ var a=document.getElementById('somediv').style.display; a=block; } The above code
I currently have the following js code function clearMulti(option) { var i; var select
I have the following JavaScript (and jQuery) code: function checkEmail(email) { if (email.length) {
I have the following code: public static function check($ip,$op,$page) { $con = new PDO(DBN,DB_USER,DB_PASS);
I have the following javascript code: function changeButtonState(targetSelector, action, iconClass) { var $target =
I have the following Javascript code: function checkIfValid(){ var form = document.createuserform; if(form.fName.value ==
I have to following code: var UserSchema = mongoose.Schema({ email: { type: String, unique:
I have the following code: function GetSetting($key) { $Result = mysql_query(SELECT * FROM settings
I have the following code: function isValidAuthor($authorID){ $query = SELECT * FROM jos_users WHERE

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.