使用jquery动态加载局部视图 [英] Loading the partial view Dynamically using jquery
本文介绍了使用jquery动态加载局部视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
如何使用jquery将ul列表(来自DB)渲染到空白的部分视图页面。
这里我不想加载如下页面
$(#div1)。html(结果);
我想使用部分视图名称加载jquery中的内容
请帮助
感谢和问候,
Soumya
Hi All,
How to render a ul list(coming from DB) in to a blank Partial view page using jquery.
Here I don't want to load page like below
$("#div1").html(result);
I want to load the content in jquery using the partial view name
Please help
Thanks & Regards,
Soumya
推荐答案
(#div1)。html(结果);
我想使用部分视图名称加载jquery中的内容
请帮助
感谢和问候,
Soumya
("#div1").html(result);
I want to load the content in jquery using the partial view name
Please help
Thanks & Regards,
Soumya
为什么不想使用有效的方法?如果您愿意,可以浏览部分视图,因为服务器仍然可以找到它。但是,您想要发出请求,获取HTML然后将其填入div中,使用您发布的jquery。我不确定你想象的其他方法可以使用,但我会创建一个我可以用AJAX调用的方法,这样我就可以返回有问题的字符串并将其填充到我想要的位置。 AJAX是我能想到的唯一一种让javascript发出Web请求并将结果存储在字符串中的方法。
Why don't you want to use the method that works ? You can browse to a partial view, if you want to, because the server will still find it. However, you want to make the request, get the HTML and then stuff it in to a div, using EXACTLY the jquery you posted. I am not sure what other method you are imagining you could use, but I'd create a method I could call with AJAX, so that I got returned the string in question and could stuff it where I wanted. AJAX is the only way I can think of to ask javascript to make a web request and store the result in a string.
这篇关于使用jquery动态加载局部视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文