How to Send a False Back to an AJAX Request

The PHP language works with Ajax to process your form and data sent by your users. The PHP "return" function can return true or false to the Ajax request. Returning false lets the Ajax request know that the data wasn't properly processed, and you can display an error message to your users. For instance, if a user doesn't fill out the whole form, you return a false message.

Instructions

    • 1

      Right-click the PHP page you use to submit your form. Click "Open With" and select your preferred PHP editor.

    • 2

      Locate the function you want to use to return false to the Ajax request. The "return false" code is placed at the end of the function.

    • 3

      Add the following PHP line of code in the PHP function:

      return false;

    • 4

      Save the file and run the Ajax request to test the new "false" return statement.

Related Searches:

References

Comments

Related Ads

Featured