call php page under Javascript function

前端 未结 5 2026
别跟我提以往
别跟我提以往 2021-01-21 09:52

Is it Possible to call php page under Javascript function? I have an javascript function and I want to call php page if someone press okk

Here is my code so far

<
5条回答
  •  醉酒成梦
    2021-01-21 10:27

    If you only want to redirect the page to the "refund" page without using AJAX you can do something along the lines of the following:

    (assumes $transaction_id variable is the id number you are looking to refund)

    HTML Lines:

        
        
        
    

    Javascript lines:

        function show_confirm(transaction_id) 
        { 
            var r = confirm("Do You Really want to Refund money! Press ok to Continue "); 
            if (r == true)   
            {   
                alert("You pressed OK!");  
                location.href = "refund.php?transaction_id="+transaction_id; 
                return true;   
            } 
            else   
            {   
                alert("You pressed Cancel!");   
            } 
        } 
    

提交回复
热议问题