1

I have the problem with url link in my MVC application when I use jquery mobile libraries

here is my header reference

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" />
<script src="http://code.jquery.com/jquery-1.5.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script>

Example

http://www.mysitename.com

if I go http://www.mysitename.com/home/audit it works fine but if I click any link button within my application it starts appending # and then url look like http://www.mysitename.com/home/audit#home/audit

The only time it happens when I use jquery mobile framework

1
  • 1
    FYI you are using an old version of JQ Mobile. It is now at 1.0 Alpha 4.1 and can be downloaded from jquerymobile.com/download. It is still buggy, but more stable than the version you are using. Commented Apr 25, 2011 at 21:39

2 Answers 2

1

Jquery mobile wraps all links so that it will send and ajax request by default. If you don't want this behaviour add rel="external" attribute to your a tag like below.

<a href="multipage.html" rel="external">Multi-page link</a>

You can read the documentation for more detailed information

http://jquerymobile.com/demos/1.0rc1/docs/pages/page-navmodel.html

Sign up to request clarification or add additional context in comments.

1 Comment

I would also add that you can disable the AJAX features across the board by simply setting ajaxEnabled to false in mobileinit: jquerymobile.com/demos/1.0a4.1/#docs/api/globalconfig.html
0

If you don't want # in ur url and want clean URL then you can use target attribute of anchor tag. You can use anchor tag using Below 2 technieqs in MVC

1) Direct in Anchor Tag

LinkText

if you use jQueryMobile then you can also give data-role="button" to give anchor tag look like button

2) Using HTML Helper

@Html.ActionLink("Log Off", "LogOff", "Account", null, new { target = "_self" })

In above both case we set target="_self" attribute of anchor tag nothing else. Let me know will it work for you or not.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.