如何在没有页面刷新的情况下成功发布后更新页面内容 [英] How to update page content after success post without page refresh

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

问题描述

我有一个mvc应用程序。这是我的ajax代码----

 $(。btnrename)。click(function(){
var check = $(。newName)。val();
if(check!=){
$ .ajax({
url:'@ Url.Action( EditUserProfile,Home)',
类型:POST,
cache:false,
data:{folderName:check,parentFolderName:checkName,
subId:checkId} ,
成功:函数(数据){
window.location.reload();
}
});
e.preventDefault();
}





i希望我的页面内容在成功后自动更新而不刷新页面。



< b>我尝试了什么:



i无法找到任何事情。

解决方案

< blockquote>(。btnrename)。click(function(){
var check =


(。newName)。val();
if(check!=){


.ajax({
url:'@ Url.Action(EditUserProfile,Home)',
类型:POST,
cache:false,
data:{folderName:check,parentFolderName:checkName,
subId:checkId},
success:function(数据){
window.location.reload();
}
});
e.preventDefault();
}





i希望我的页面内容在成功后自动更新而不刷新页面。



我尝试了什么:



i无法找到任何可以做的事。


I have a mvc application.this is my ajax code----

$(".btnrename").click(function () {
                   var check = $(".newName").val();
                   if (check != "") {
                       $.ajax({
                           url: '@Url.Action("EditUserProfile", "Home")',
                           type: "POST",
                           cache: false,
                           data: { folderName: check, parentFolderName: checkName,
                                                                  subId: checkId },
                           success: function (data) {
                               window.location.reload();
                           }
                       });
                       e.preventDefault();
                   }



i want that my page content update automaticaly without page refresh after success.

What I have tried:

i am unable to find anything to do.

解决方案

(".btnrename").click(function () { var check =


(".newName").val(); if (check != "") {


.ajax({ url: '@Url.Action("EditUserProfile", "Home")', type: "POST", cache: false, data: { folderName: check, parentFolderName: checkName, subId: checkId }, success: function (data) { window.location.reload(); } }); e.preventDefault(); }



i want that my page content update automaticaly without page refresh after success.

What I have tried:

i am unable to find anything to do.


这篇关于如何在没有页面刷新的情况下成功发布后更新页面内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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