Ajax成功功能后如何在不刷新主页的情况下重定向页面 [英] How redirect page without refreshing main page after ajax success function

查看:130
本文介绍了Ajax成功功能后如何在不刷新主页的情况下重定向页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ajax成功运行后,我想不刷新主页面而将页面重定向到comment.php

After ajax success function, I want to redirect page to comment.php without refreshing main page

$.ajax({
    type: "POST",
    url: "save_edit.php",
    data: { id1: id, comment1: comment }, 
    success: function(data) {
        $("#feedback").html(data);
        $('#feedback').fadeIn('slow', function() {
            $('#feedback').fadeOut(4000);
            window.location = "comment.php";
        }
 });

推荐答案

$.ajax ({
     type: "POST",
     url: "save_edit.php",
     data: { id1: id, comment1: comment },

     success: function(data) {
             $("#feedback").html(data);
             $('#feedback').fadeIn('slow', function() {
             $('#feedback').fadeOut(4000);
             $.ajax ({
              type: "POST",
              url: "comment.php",
              data: {  },
             });
            }
 });

这篇关于Ajax成功功能后如何在不刷新主页的情况下重定向页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆