I've one more question. I have a view which is containing an "add" link. Everytime I press this link a partial view should be added dynamically (for example with jQuery).
I've tried to do that by this way:
$('#Div1').load('<%= Url.Action( "Video", "ddd", new { id = "1", url="ko" } ) %>');
But this method do not add a partial it just replace the content of "Div1" with the partial.
When I try:
$('#Div1').append('<%= Url.Action( "Video", "ddd", new { id = "1", url="ko" } ) %>');
there is something added to my Div but no partial view. Just the path of the partial view is added: /de/Market/ddd/Video/1?url=ko
My code in the controller looks like this:
public ActionResult Video(string url, int id)
{
ViewModels.Video v = new Video();
v.URL = url;
v.ID_Video = id;
return PartialView("Video", v);
}
Any ideas how to solve this problem? (I'm using MVC2)
I've one more question. I have a view which is containing an "add" link. Everytime I press this link a partial view should be added dynamically (for example with jQuery).
I've tried to do that by this way:
$('#Div1').load('<%= Url.Action( "Video", "ddd", new { id = "1", url="ko" } ) %>');
But this method do not add a partial it just replace the content of "Div1" with the partial.
When I try:
$('#Div1').append('<%= Url.Action( "Video", "ddd", new { id = "1", url="ko" } ) %>');
there is something added to my Div but no partial view. Just the path of the partial view is added: /de/Market/ddd/Video/1?url=ko
My code in the controller looks like this:
public ActionResult Video(string url, int id)
{
ViewModels.Video v = new Video();
v.URL = url;
v.ID_Video = id;
return PartialView("Video", v);
}
Any ideas how to solve this problem? (I'm using MVC2)
Share Improve this question edited Apr 19, 2011 at 10:06 kapa 78.8k21 gold badges165 silver badges178 bronze badges asked Apr 19, 2011 at 9:33 HW90HW90 1,9832 gold badges22 silver badges45 bronze badges2 Answers
Reset to default 5You can add your dynamically loaded content wrapped in individual divs to #Div1 as a container:
$('<div>').appendTo('#Div1').load('<%= Url.Action( "Video", "ddd", new { id = "1", url="ko" } ) %>');
Use
$('#Div1').append(...)
This should help.