AJAX / JQUERY重新加载


                    

如果AJAX返回成功,我希望它重新加载,但不是整个页面,而是我所在页面的一部分,那么我将PHP与AJAX一起使用。</ p>

我设法获得它,以便如果它返回成功,它会发布一条消息,然后重新加载页面,但是我不希望重新加载整个页面。</ p>

  if(data =='success'){
     $('#error_notyfi_change_name')。css(“ color”,“ green”);
     $('#error_notyfi_change_name')。text(“您已创建新等级!”);
     $('#confirm_question_change_name')。hide();

     location.reload();
}
</ code> </ pre>

如您所见,这会生成整个页面的重新加载,但可以说我在帮派页面上,然后单击“创建新等级”部分,它将在我的帮派页面中打开此页面,该页面位于总布局内。 我只希望它刷新帮派部分而不是整页。</ p>

如果我对自己的解释不够清楚,我深表歉意。</ p>
     </ div>

展开原文

原文

I am using AJAX alongside PHP if the AJAX returns a success I want it to reload, but not the whole page, just the part of the page that I am on.

I have managed to get it so that if it returns a success, it posts a message and then does a page reload, but I do not want a full page reload.

if (data == 'success') {
    $('#error_notyfi_change_name').css("color", "green");
    $('#error_notyfi_change_name').text("You have created a new rank!");
    $('#confirm_question_change_name').hide();

    location.reload();
}

As you can see, this generates a full page reload, but lets say I am on the gangs page, I then click on create new rank section, it opens this up within my gangs page, which is within the total layout. I just want it to refresh the gangs section rather than the full page.

I apologize if I haven't explained myself clearly enough.

1个回答


  if(data =='success'){
    $('#error_notyfi_change_name')。css(“ color”,“ green”);
    $('#error_notyfi_change_name')。text(“您已创建新等级!”);
    $('#confirm_question_change_name')。hide();
        // location.reload();
    $(“。divClass”)。load(location.href +“ .divClass”); //仅从location.href URL重新加载.divClass。
}
</ code> </ pre>
     </ div>

展开原文

原文

if( data == 'success') {
   $('#error_notyfi_change_name').css("color","green");
   $('#error_notyfi_change_name').text("You have created a new rank!");    
   $('#confirm_question_change_name').hide();
       // location.reload();
   $(".divClass").load(location.href + " .divClass"); // reloads only the .divClass from the location.href URL.
}

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐