调用点击按钮的功能(toastr js)

时间:2019-11-25 01:51:53

标签: javascript php toastr

伙计们,我该如何调用toastr js函数,我有点想单独调用它,而不是使用toastr按钮本身。.我想在表单按钮提交后调用它,但过程在两个单独的页面之间。 .index.php和process.php,因此对索引进行填写,然后将其提交给process.php,然后将结果发送回索引,但是我停留在验证过程中,以通知用户它是成功还是失败,我想使用烤面包机按钮。



这是我的代码

index.php

r

process.php


<?php
if(isset($_SESSION["process_status"])){
  if($_SESSION["process_status"]==1){
   ///i need to call it here
   ///calling toastr using button i use <button class="btn btn-danger swalDefaultSuccess" id="callButton">call function</button> but dunno how i call its function without the click event
  //  echo callFunction();
    //call function toastr here
  }else if($_SESSION["process_status"]==2){

  }
}else{
  //set back to zero if proccess is complete or failed
  $_SESSION["process_status"]=0;
}
?>

 ///////////
 some fill out form here with long code
 <divs> and input type......
 ////form for submit is here but i summarized it make it short
<div class="card-footer">
                  <button type="submit" class="btn btn-primary float-right" formaction="process.php?id=1">Submit</button>

                </div>
              </form>



烤面包机JS脚本

<?php 
session_start();
$_SESSION["process_status"]=0;

    //1. register new account



    $lastName = $_POST['lastName'];
    $firstName = $_POST['firstName'];
    $middleName = $_POST['middleName'];

    $pass=$_POST["pass"];
    $conpass=$_POST["conpass"];






    if(isset($_GET["id"])){
        if($_GET["id"] ==1){
            if($conpass ==$pass){
                $_SESSION["process_status"] = 1;
                //do insert data to database here
            }else{
                //promp wrong password

            }
        }
    }
header('Location:index.php');
?>

如果您认为我的方法太长或真的错误,我可以接受其他建议,请不要对JS即时消息感到厌烦,更不要说对php和html了。

0 个答案:

没有答案