Calling a MVC2 partial view using jquery returns empty string problem
- by Jason
I have an issue where I have a partial view that returns some HTML to be displayed. Its called when something is clicked on the page using jquery. The problem is that no matter how I call it, i get back an empty string even though it reports success. This is happening to me using Chrome, going against my local machine.
My controller looks like this:
public ActionResult MyPartialView()
{
return PartialView(model);
}
I have tried jquery using .get(), .post() and .load() and all have the same results. Here is an example using .post():
$.post(url, function (data)
{
alert(data);
});
The result always comes back as an empty string. I can navigate to the partial view in the browser manually and i get back the desired HTML. The URL I am using to call it I resolved fully so it looks like "http://localhost/controller/mypartialview" rather than using the relative path of "/controller/mypartialview" which I thought was the original problem. Any idea what may cause this?