单击按钮和窗口确认以更新查询和重定向页面

时间:2016-04-27 07:34:00

标签: php mysql ajax

我有重定向页面和查询更新的问题。如果我点击按钮,有一个窗口确认,如果我点击是,我调用ajax将数据发送到我的PHP页面,我的PHP页面进行查询。成功后,我想重定向到另一页。这是我的HTML代码

import tkMessageBox
import turtle
def main () :
    turtle.onscreenclick(getPos)
    SetTimer() #call for the function to setup the timer, you can call this function when certain conditions are met rather than at startup.
    mainloop()

def SetTimer():
    canvas = turtle.getcanvas() #get current turtle canvas to set the after call on.
    canvas.after(2000, CalledAfter2000ms, canvas) #first parameter specifies time in miliseconds to wait before the call to CalledAfter2000ms function which is in the second paramater, the third paramater here is the paramater im passing to the CalledAfter2000ms function.

def CalledAfter2000ms(canvas): #function passed to canvas.after(...)
    if tkMessageBox.askyesno("EXIT","Do you really want to exit?"): #if yes is pressed, True is returned, if no is pressed then False is returned.
        turtle.bye() #exits the application

这是我的PHP代码

$(document).on("click", "#tombolvalidasi", function() {
        var pil = <?php echo $_GET['pilih']; ?>;
        var r = confirm("Validasi Pesanan?");
        if (r == true) 
        {
            $.ajax({
                    type: "GET",
                    url: host+'/skripsi3/web/validasipesan.php',
                    data: { "id": pil},
                    success: function (data){
                         if (data == "success") {
                             window.location = "pesanvalid.php?pilih="+pil;
                         }

                    },
                    error: function (e) {
                        alert('Fail');
                    }
                });
        } 
        else 
        {

        }

    });

&GT;

希望有人能告诉我我的代码有什么问题。谢谢你们 祝你今天愉快!!干杯!!

0 个答案:

没有答案