1

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?

Fabrizio Mazzoni
  • 1,831
  • 2
  • 24
  • 46
  • this will help you http://stackoverflow.com/questions/12058248/how-to-pass-parameters-while-changing-the-page-in-jquery-mobile – Nishit Maheta May 26 '15 at 12:09
  • Have a look here: https://jqmtricks.wordpress.com/2014/01/22/passing-parameters-between-pages-multi-page-model/ – ezanker May 26 '15 at 12:56

2 Answers2

1

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);
        }
    })
})
Ashish Bhagat
  • 409
  • 3
  • 16
0

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.

Ajai
  • 901
  • 9
  • 21