I have a jquery mobile app that uses 2 data-role=page divs.
<div data-role="page" id="main"></div>
<div data-role="page" id="det"></div>
On the link to switch from main to truckdet I use
<a href="#det">LINK</a>
Is there a way to pass a parameter in the href
so I can dynamically extract data from a database and embed it in the det
div?
I asume you want to get data from DB using ajax and put content in desired div. Use this
$('a').click(function(e){
e.preventDefault();
var target = $($(this).attr('href'));
var url = your_url_here;
$.ajax({
url: url,
success: function(value){
target.html(value);
}
})
})
You can pass data thorough href
like this.
<a href="#det?value=somevaluestobepassed">LINK</a>
I am not sure if it works for your case.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.