Redirect with PHP after ajax call

后端 未结 5 458
庸人自扰
庸人自扰 2020-12-06 07:11

Im doing the following ajax call:

$(\'#save_sale\').click(function() {
    var save_sale = 1;
    $.ajax({
        type: \'GET\',
        url: \'summary.php\         


        
5条回答
  •  不思量自难忘°
    2020-12-06 08:00

    on your js page

     $.ajax({
            type: 'GET',
            url: 'summary.php',
            data: {save_sale: save_sale},
            //success: function(data) { /* Do something here?? */ },
            error: function(xhr, ajaxOptions, thrownerror) { }
        }).success(function(data) {
           window.location('addcust.php?new_sale='+data.id)
        });
    

    on your php script echo the id

    $data['id'] = ;
    echo json_encode($data);exit
    

    hope it will work.

提交回复
热议问题