Open a popup box after receiving result from ajax

前端 未结 3 1143
孤城傲影
孤城傲影 2021-01-19 19:15

i have a ajax code that works properly and gives the desired result. I want to modify this code and want that when a reply is received from ajax a popup/modal box should get

3条回答
  •  心在旅途
    2021-01-19 20:11

    You can use $("#bsModal3").modal('show'); inside your result.

    See more about modal methods

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

提交回复
热议问题