如何加载$(文档).Ready()当我将部分视图的响应Html绑定到子Div [英] How To Load $(Document).Ready() When I Am Binding A Response Html Of Partial View To A Child Div

查看:104
本文介绍了如何加载$(文档).Ready()当我将部分视图的响应Html绑定到子Div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Friends,



我在MVC应用程序的当前开发中遇到了一个问题,我在这里给出一个ajax调用来加载局部视图。该部分视图返回一个html作为响应。并且html被分配给childdiv。

Hello Friends,

I am facing an issue in my current development in MVC Application, where i give an ajax call to load a partial view. That partial view returns a html in response. and further that html is been assigned to a childdiv.

$.ajax({
        type: "POST",
        url: $('#baseurl').val() + "sample url",
        data: jsonString,
        contentType: "application/json; charset=utf-8",
        dataType: "html",
        success: function (response) {
            $("#Middle").children().find("div#sampleDiv").html(response);
        },
        error: function () {
        },
        complete: function () {
        }
    });



现在的问题是响应 html有一个$(document).ready()状态,它不会在i中执行$(#Middle)。children()。find(div#sampleDiv)。html(response);。



我的问题是如何显式调用/执行document.ready of response html。


Now problem is that "response" html is having a $(document).ready() state which does not execute in i assign $("#Middle").children().find("div#sampleDiv").html(response);.

my question is how to explicit call/execute document.ready of response html.

推荐答案

.ajax({
类型: POST
url:
.ajax({ type: "POST", url:


' #baseurl')。val()+ 示例网址
数据:jsonString,
contentType: application / json; charset = utf-8
dataType: html
成功: function (响应){
('#baseurl').val() + "sample url", data: jsonString, contentType: "application/json; charset=utf-8", dataType: "html", success: function (response) {


#Middle)。children()。find( div#sampleDiv)。html(响应);
},
错误: function (){
},
complete: function (){
}
});
("#Middle").children().find("div#sampleDiv").html(response); }, error: function () { }, complete: function () { } });



现在问题是响应html有一个


Now problem is that "response" html is having a


这篇关于如何加载$(文档).Ready()当我将部分视图的响应Html绑定到子Div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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