• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Open a popup box after receiving result from ajax

javascriptphpjqueryajaxpopup


PHP Snippet 1:

success: function (returndata) {
    if (returndata[4] === 1) {
        $('#bsModal3').modal(); // this
    } else {
        // other code
    }
},

PHP Snippet 2:

$.ajax({
        type: 'post',
        url: 'test2.php',
        dataType: 'json',
        data: {
            txt: txtbox,
            hidden: hiddenTxt
        },
        cache: false,
        success: function (returndata) {
            if (returndata[4] === 1) {
               $('#bsModal3').modal();  // Please right this in your Code
            } else {
                // other code
            }
        },
        error: function () {
            console.error('Failed to process ajax !');
        }
    });

Related Snippets

Group rows by column and sum another column within groups [duplicate]

What is the difference between client-side and server-side programming?

Laravel Pagination links() not working

Laravel insert dynamic input values with radio button

Pass an image through AJAX [duplicate]

PHP if in_array() how to get the key as well?

Passing PHP JSON to Javascript: echo json_encode vs echo json declaration

Star and Half Star Rating in Laravel

IlluminateDatabaseQueryException: SQLSTATE[HY000]: General error: 1 no such table - In clone project

Facebook SDK error: Cross-site request forgery validation failed. Required param "state" missing from persistent data

HTML + PHP + PHPMAILER

How to submit a form when page loads using JavaScript?

Converting array to string and then back in PHP

Render the content of default_filter.php in Joomla front-end

JQuery content editable div and text box on submit not sending POST

About Contact Privacy policy Terms and conditions