Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery Mobile Links with MVC

I'm setting up a JQuery mobile site with ASP.NET MVC 3 and the Razor UI. I'm generating my links like:

<a href='@Url.Action("View", "Users", new { Group = 2 })' data-role="button">See Group 2</a>

Say I'm accessing it from Home/Index. The issue I'm having is when I click on the link, it does:

http://localhost/myapp/Home/Index#myapp/Users/View

I also tried the direct helper @Html.ActionLink("View", "Users", ...) and I'm getting the same issue with the URL's, and it's causing the application to break. Putting a / before the link is worse. Any ideas?

Thanks.

like image 581
Brian Mains Avatar asked Oct 10 '22 09:10

Brian Mains


1 Answers

Per link you can do this:

Set a rel=external attribute, or set any target attribute.

Globally you can do this:

$(window.document).bind("mobileinit", function() {

    $.mobile.ajaxEnabled = false;
    $.mobile.hashListeningEnabled = false;

});

jQuery Mobile's navigation model

like image 170
rick schott Avatar answered Oct 13 '22 11:10

rick schott