I am creating a mobile app that displays a "students" classes. For example, 开发者_如何转开发a list is generated on a jQm page ("entity_list") which when clicked will take them to another section on the same page where it will pull a list of information regarding that list. This is done via an id embedded in the url like so:
<a href="#entity" data-identity="'.$class['id'].'">'.$class['title'].'</a>
When clicked this code is used to extract that information:
$("a[href=#entity]").live("click",
function(e) {
navIdentity = $(this).data("identity");
$.post("entity.php", { entity_id: navIdentity} );
$("#entity").page();
}
);
The problem I am facing is that I can't then extract that id to then load more via php.
Does ANYONE know if theres a better way or how to fix this. Thanks a bunch!
How about this?
navIdentity = $(this).attr("data-identity");
Will it work?
There is probably an issue with the selector. Yours is
$("a[href=#entity]")
I assume you need to add quotes, like this
$("a[href='#entity']")
See the jQuery API at http://api.jquery.com/attribute-equals-selector/
精彩评论